On Aug 8, 2006, at 11:52 AM, Aaron Mulder wrote:
So far the idea is to put an EntityManagerFactory in JNDI for each persistence unit at java:comp/env/jpa/(persistence-unit-name) . The problem is that every component type in Geronimo uses a different GBean and attribute to hold the JNDI context.
So check this idea out -- you'll flip. What if we use the context.xml to override the class that registers the root java: jndi provider :) Dain and I were going back and forth on what would be the easiest way to slice in something that could also work for 1.1.x and that was the best we came up with. You basically override the jndi provider with one that will first check for objects that are "java:comp/jpa/(persistence-unit-name)" and delegate that to the special JPA plugin functionality. Notice I've used "java:comp/jpa" instead of "java:comp/env/jpa". The idea being that it's a global thing and not specific to an ENC of a component. This new JNDI provider would not be JPA specific either, it would require a reference collection of things that implemented javax.naming.Context or perhaps as an alternate javax.naming.spi.ObjectFactory. You could actually register a hole bunch of them and add all sorts of extended jndi ability via other gbeans and plugins.
-David
