[jboss-user] [Beginner's Corner] - accessing persistence unit in jar.

Monty Hall do-not-reply at jboss.com
Mon Dec 26 10:30:08 EST 2011


Monty Hall [http://community.jboss.org/people/monty_hall] created the discussion

"accessing persistence unit in jar."

To view the discussion, visit: http://community.jboss.org/message/643212#643212

--------------------------------------------------------------
New to jboss and created the following projects using jboss tools in eclipse.

Name                  Eclipse Project
EAR                   EAR Project
EJB                   EJB Project
PERSISTENCE           JPA Project
WEB                   Dynamic Web Project


In a backing bean in the WEB project, I cannot create an entity manager.

@Named
@RequestScoped
public class UserAction {
          @PersistenceContext
          private EntityManager em;


          public String getText() {
                    return "UserAction";
          }
}



I've tried '@PersistenceContext(unitName="PERSISTENCE")' and '@PersistenceContext(unitName="PERSISTENCE.jar#PERSISTENCE")' no luck.


Monty

-------------------------------------------
The persistence.xml in the PERSISTENCE project is:


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
          <persistence-unit name="PERSISTENCE">
                    <jta-data-source>java:jboss/datasources/xxxx</jta-data-source>
                    <exclude-unlisted-classes>false</exclude-unlisted-classes>
          </persistence-unit>
</persistence>
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/643212#643212]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111226/82643a41/attachment-0001.html 


More information about the jboss-user mailing list