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

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.

主站蜘蛛池模板: 嘉义县| 广州市| 平顶山市| 阿勒泰市| 尼勒克县| 凌海市| 友谊县| 渝中区| 年辖:市辖区| 徐汇区| 永吉县| 南川市| 新和县| 乌兰察布市| 平定县| 十堰市| 治多县| 宕昌县| 盐池县| 久治县| 永川市| 敦化市| 南汇区| 汶上县| 琼海市| 金华市| 郸城县| 兴义市| 缙云县| 陕西省| 文昌市| 迁安市| 宜良县| 鸡东县| 龙井市| 鄄城县| 澄江县| 雷山县| 会东县| 吴旗县| 会宁县|