On Aug 26, 2012, at 11:06 PM, Enrico Olivelli wrote: > I'm implementing https://issues.apache.org/jira/browse/OPENEJB-731 > I'm adding it to: > org.apache.openejb.config.rules.CheckPersistenceRefs > > but I think I need the real PersistenceUnit, what is the best way to get it ?
The persistence-unit definitions will be in the AppModule.getPersistenceModules(); Be warned that the actual matching of persistence units to references can get a little complicated. There is actually a lesser known and lesser used URI syntax for identifying a jar and a unit name. So we'll either need to be ok with giving up if we are unable to resolve it, or to duplicate the resolution logic. What check were you imagining? There's a check we don't have about making sure an @EntityManager reference doesn't point to an RESOURCE_LOCAL unit. Would be great to get that check, such a common mistake. I did a whole section on it at JAXConf: http://svn.apache.org/repos/asf/openejb/trunk/presentations/2012_JAXConf_Tomcat_to_JavaEE_with_TomEE.pdf -David