Version 4, last updated by paul.dale at 20 Jan 00:18 UTC

The lift-jta module is a thin convenience layer over transactional modifications for entities managed with an EntityManager. It is currently not a general jta solution. If you have suggestions for further enhancements to the modules please bring it up on the lift list.

The options available for the Context are listed in the scaladocs.

In short – If you are currently using jpa, hibernate, or any other framework which provides you with an EntityManager then this is a nice way to make transactional updates to entities.

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
}