JBoss Community

Re: jboss7 quickstarts entitymanager injection question

created by robert walker in JBoss AS7 Development - View the full discussion

ok, this is becoming a bit clearer,

 

however

 

both examples (login and kitchensink) point to

 

<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>

 

in thier persistence.xml (each one gives a different name for thier persistence-unit name, one named primary and the other loginDatabase)

 

so because both point to same the DS then

 

@Inject

EntityManager

 

works in both sample applications? Jboss can know which pu to assign to the entitymanager?

 

the login app would not get associated with the PU for kithensink?

 

 

If I add my own, do I also use

@Inject   // or maybe  @PersistenceContext if not using the resource producer pattern

 

private EntityManager em;

 

thanks

 



Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community