-
1. Re: EntityManager injection: @PersistenceContext or @In ??
graben May 22, 2008 6:14 PM (in response to benmoore)With @In you inject the seam entitymanager which is injected all over the conversation. for further informations read the manual.
-
2. Re: EntityManager injection: @PersistenceContext or @In ??
dan.j.allen May 22, 2008 6:37 PM (in response to benmoore)I just finished writing an extremely detailed explanation of the difference between the two in the updated chapters 8 and 9 of Seam in Action. These chapters will go out with the MEAP in a week or so. I can try to summarize with a few short bullets:
- Seam is not involved in @PersistenceContext injection
- It is proxied to give you EL and Hibernate Search
- Right now manual flushing and Hibernate filters are not available
- There are complex rules for sharing amongst EJB components and JavaBean components cannot use it at all
Again, I go through all of this in detail.
-
3. Re: EntityManager injection: @PersistenceContext or @In ??
infinity2heaven May 22, 2008 10:19 PM (in response to benmoore)Dan -- I'm looking fwd for that revision as I'm disappointed with the coverage of this topic in the initial MEAP release.
Personally, I prefer using @In as Seam adds many
features
on top of EJB3, does flushing/merging all by default without the need to override these settings, in most standard use cases. Most importantly, you won't get the infamous LazyInitializationException if use @In. I have't trried the extended Persistent Context in @PersistenContext though. -
4. Re: EntityManager injection: @PersistenceContext or @In ??
benmoore May 23, 2008 2:08 AM (in response to benmoore)Thanks, Dan. It isn't clear to me if the last 3 bullet points apply to @In or @PersistenceContext. Can you elaborate? I'll definitely be getting your book, even if I don't know what MEAP means.
Thanks,
Ben -
5. Re: EntityManager injection: @PersistenceContext or @In ??
dan.j.allen May 23, 2008 11:50 PM (in response to benmoore)You won't be disappointed with the new chapters (chapter 8 and 9). Also, I explain LIE and its circumstances in detail. You don't need @In to avoid LIE, you need a conversation-scoped persistence context. Seam's EntityManager is conversation-scoped by default. A container-managed persistence context is made conversation-scoped by using @PersistenceContext(EXTENDED) on SFSB.
-
6. Re: EntityManager injection: @PersistenceContext or @In ??
dan.j.allen May 23, 2008 11:52 PM (in response to benmoore)All of those bullet points pertain to @PersistenceContext injection. As you can see, you can make it work, but a Seam-managed persistence context is just inherently better.
MEAP = Manning Early Access Program (basically, a PDF of the chapters in rough format)