Hi David,
           I have already done that. I will get the
EntityManagerFactory But for getting the entity manager I need to
write a class OpenEJBManagedRuntime implements ManagedRuntime which
looks up the transaction manager of openejb and gives it to openjpa. I
got that done too. But need to resolve some errors coming in other
modules due to my changes :-( . Will post a patch as soon as I resolve
those errors.

Thanks
Manu

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

On Dec 3, 2006, at 1:53 PM, Manu George wrote:

> 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?

Excellent!  That's a great first run.  It is supposed to be of the
java:comp/env variety, but using "java:openejb/connector/Default JDBC
Database" will work just fine to start with.  We'll likely have to
rework the code a bit to support the java:comp/env thing.

Anyone want to update the Enc*Bean tests to test lookup of
PersistenceUnits?

-David

> 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