[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3612) examples should demonstrate obtaining entity manager factory from JNDI via persistence unit reference

Dan Allen (JIRA) jira-events at lists.jboss.org
Mon Nov 24 23:58:36 EST 2008


    [ https://jira.jboss.org/jira/browse/JBSEAM-3612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12439597#action_12439597 ] 

Dan Allen commented on JBSEAM-3612:
-----------------------------------

Done. Working for the JPA example to GlassFish.

It would require more work to implement this in the JEE5 example since GlassFish requires entity classes and the persistence unit descriptor to be packaged as a standalong JAR. But still, something to think about.

> examples should demonstrate obtaining entity manager factory from JNDI via persistence unit reference
> -----------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3612
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3612
>             Project: Seam
>          Issue Type: Feature Request
>          Components: Examples
>    Affects Versions: 2.1.0.GA
>            Reporter: Dan Allen
>            Assignee: Dan Allen
>            Priority: Minor
>             Fix For: 2.1.1.CR2
>
>   Original Estimate: 4 hours
>  Remaining Estimate: 4 hours
>
> For any example that is deploying to a standard Java EE 5 environment (for instance the jpa example deploying to GlassFish or JBoss AS 5), the entity manager factory should be obtained through JNDI through a persistence unit reference.
> 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."
> It would first need to be declared in web.xml:
>    <persistence-unit-ref>
>       <persistence-unit-ref-name>bookingDatabase/emf</persistence-unit-ref-name>
>       <persistence-unit-name>bookingDatabase</persistence-unit-name>
>    </persistence-unit-ref>
> Then the components.xml would look like this:
> <persistence:managed-persistence-context name="entityManager"
>     auto-create="true"
>     persistence-unit-jndi-name="java:comp/env/bookingDatabase/emf" />
> The reason we should do this is to advocate the Java EE standard approach.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list