Hi David B ,
        I got it working i.e am able to get the EntityManagerFactory
from JNDI. In the persistence.xml I have to give the jta datasource as
java:openejb/connector/Default JDBC Database for the default datasource
Is this approach acceptable? Or should it be in the
java:comp/env/jdbc/datasource format?

Thanks
Manu

On 12/2/06, David Blevins <[EMAIL PROTECTED]> wrote:

On Dec 1, 2006, at 12:02 PM, Manu George wrote:

>              I have a doubt in this JIRA. There is a class called
> EntityManagerFactoryCache which is an object factory already present
> in OEJB. It also has variables to store all the
> EntityManagerFactories.

You probably don't want to use that object.  Likely somewhere in the
EjbJarBuilder you'll use the PersistenceDeployer.loadPersistence
method directly to get all the EntityManagerFactories.  Then you'll
probably want to pass that map into the constructor of the
EnterpriseBeanBuilder and then into the constructor of the
JndiEncBuilder.

In the JndiEncBuilder you'll add a new method to process all the
PersistenceUnitInfo objects in JndiEncInfo.  Of course the
PersistenceUnitInfo class doesn't exist yet, let me just create that
to make this first one easy.  Ok, see this commit:

    http://svn.apache.org/viewvc?view=rev&revision=481478

(ignore that change to JndiEncBuilder, that was unrelated)

You'll need to implement the method
JndiEncInfoBuilder.buildPersistenceUnitRefInfos() created with that
commit.

> I also noticed that there are two Reference interfaces in  OEJB
> in org.apache.openejb.core.ivm.naming and org.apache.openejb.naming
> packages. What is the significance of having two? Why don't any of the
> references extend from the javax.naming package?

Our current JNDI implementation is just a bit obtuse.  I predict at
some point in the future we may ditch it for the xbean-naming
implementation which is a bit nicer.  Till then just create an
implementation of org.apache.openejb.core.ivm.naming.Reference and
pass the EntityManagerFactory right in the constructor.

We may want to switch it to create the EntityManagerFactory inside
the getObject method of the Reference class, but this is good enough
for now.  We'll see what the TCK has to say about it when the time
comes.

-David




Reply via email to