April 2018
Intermediate to advanced
382 pages
10h 11m
English
Another important piece of code is the following:
@Statefulpublic class UserBean { @PersistenceContext(unitName = "ch02-jta-pu", type = PersistenceContextType.EXTENDED) private EntityManager em; ...}
So, here we are defining our PersistenceContext as EXTENDED. It means that this persistence context is bound to the @Stateful bean until it is removed from the container.
The other option is TRANSACTION, which means the persistence context would live only by the time of transaction.
Read now
Unlock full access