On Dec 5, 2006, at 10:47 AM, David Jencks wrote:
On Dec 3, 2006, at 4:11 PM, David Blevins 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,
I disagree. As I understand it, the jpa EMF is something you
configure in the server, not per ejb. Thus the datasource it uses
should not change depending on which ejb happens to be using it.
Took a closer look at the tck and it looks like you're right. I
assume then that the way you specify a global data source name is
vendor specific and no spec defined?
Same for EM.
All or most of this stuff is all working in geronimo/openejb2. It
might be useful to look at as a reference or even consider sharing
code.
I will. On the same note was the code that creates EMFs in openejb3
useful when you created the one in geronimo/openejb2? Hope there was
something in there you could reuse.
-David
thanks
david jencks
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