- Jakarta EE Cookbook
- Elder Moraes
- 72字
- 2021-06-24 16:12:46
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.
推薦閱讀
- 少兒人工智能趣味入門:Scratch 3.0動畫與游戲編程
- Learning ASP.NET Core 2.0
- 機械工程師Python編程:入門、實戰與進階
- 21天學通C++(第6版)
- .NET 3.5編程
- Mastering Android Game Development
- Getting Started with React Native
- Java Web從入門到精通(第3版)
- Node.js從入門到精通
- Anaconda數據科學實戰
- 深入淺出Python數據分析
- 超簡單:Photoshop+JavaScript+Python智能修圖與圖像自動化處理
- Deep Learning for Natural Language Processing
- Professional JavaScript
- GO語言編程從入門到實踐