On 22 Oct 2008, at 18:31, Dan Allen wrote:
> Yes, in fact with any Java EE 5 container, we should make it a
> policy in the examples to assume that the container is taking care
> of the persistence unit rather than Seam. Seam should only step in
> when the container isn't willing or able (such as with JBoss AS 4.2).
What? This isn't something that is mandated by the EE5 spec so how
does this work? Looking up the EMF over JNDI only works in JBoss.
The problem here isn't about EMF lookup, it's about whether the
container deploys the PU or not (JBoss 4.2 doesn't for a war, whilst
JBoss 5 does).
That's not true. If defined as persistence-unit-ref in web.xml (I
know, silly requirement) a Java EE container will load the
persistence unit and make it available in JNDI for that application.
Can you add that to the issue then :-) We should do this in any EE
example that deploys to anything but JBoss and uses SMPCs (none AFAIK).
5.3.1 of JPA spec:
"Within a Java EE environment, an entity manager factory may be
injected using the Persistence-Unit annotation or obtained through
JNDI lookup."
JBoss 4 did not support this. Hibernate on JBoss AS just happens to
support putting it in JNDI defined in a vendor properties (w/o the
resource reference).
No, it is JBoss EJB3 that did this :-)