官术网_书友最值得收藏!

There's more...

Another important piece of code is the following one:

@Stateful
public class UserBean {

@PersistenceContext(unitName = "ch02-jta-pu",
type = PersistenceContextType.EXTENDED)
private EntityManager em;

...
}

Here, we are defining PersistenceContext as EXTENDED. This 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 will only live for the duration of the transaction.

主站蜘蛛池模板: 湟中县| 东莞市| 东港市| 垦利县| 娱乐| 万源市| 辽宁省| 宜兰县| 上高县| 普格县| 长治县| 溆浦县| 民乐县| 乐东| 临沂市| 平塘县| 上虞市| 宁海县| 蒙阴县| 怀远县| 嫩江县| 星子县| 南靖县| 西丰县| 宁化县| 肃宁县| 屏东市| 普定县| 昭苏县| 桑植县| 休宁县| 乌什县| 赤壁市| 宜兴市| 柯坪县| 驻马店市| 濮阳市| 张家口市| 巴中市| 潞城市| 平原县|