目次

Version 1, last updated by paul.dale at Nov 28 01:17 UTC

// From the TransactionContext Class scaladoc – more clarification would be helpful.

Example usage 1:


for {
ctx <- TransactionContext.Required
entity <- updatedEntities
if !ctx.isRollbackOnly
} {
// transactional stuff
ctx.getEntityManager.merge(entity)
}

Example usage 2:


val users = for {
ctx <- TransactionContext.Required
name <- userNames
} yield {
// transactional stuff
val query = ctx.getEntityManager.createNamedQuery(“findUserByName”)
query.setParameter(“userName”, name)
query.getSingleResult
}