geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Genender <jgenen...@apache.org>
Subject Re: JPA plugin (was Re: Java 1.4 and JEE 5)
Date Sat, 12 Aug 2006 03:07:13 GMT


Aaron Mulder wrote:
> On 8/11/06, Jeff Genender <jgenender@apache.org> wrote:
>> With regard to duplicating PUs, in theory, it shouldn't make a
>> difference if the PU was already loaded in a parent loader.
> 
> I think it does.  The web app is not necessarily supposed to see JPA
> configurations in an EJB JAR, only JPA configurations at the EAR
> level.  
> And I don't think we have a way to distinguish between the
> two.  Further, I don't think we'd want the web app to do it's own
> processing of a persistence.xml at the EAR level -- I think we'd want
> the EAR to do the processing and just expose that "common" JPA
> configuration to the web app (the spec is pretty clear on that).
> Whereas if the persistence.xml is in the web app, it should do all the
> JPA processing as part of the web app deployment.
> 
> So I think that somehow we'd like a web app to be able to discriminate
> between "persistence.xml in me" (do lots of deployment processing),
> "persistence.xml in my EAR" (use shared configuration), and
> "persistence.xml in other modules in the EAR that happen to have been
> merged into the EAR ClassLoader" (ignore).


Ok, I understand where you are going with this. I totally agree with
your thinking here.  But...IIUC...in the web app, if you are including
your own PU, you likely wouldn't be using the JNDI (and thus the
container) for this and would be declaring use of the spi bootstrap
directly:

EntityManagerFactory emf =
Persistence.createEntityManagerFactory("mywebpersistenceunit")

And when using the EJB, you would call the JNDI.  Therefore, I don't
think this is a problem at all.

> 
> Thanks,
>     Aaron
> 
>>  But unless
>> the spi jar uses some sort of mechanism using static declarations or
>> componanents like Spring, then it really shouldn't be an issue.  If it
>> is, I think its reasonable to claim storage of duplicate PUs in the same
>> package causing the problem (again, like the Spring Commons Logging
>> problem).
>>
>> >
>> > Thanks,
>> >     Aaron
>> >
>> >> Aaron Mulder wrote:
>> >> > So what happens if an EJB JAR has a persistence.xml and a web app in
>> >> > the same EAR has a separate persistence.xml?  If we just look in the
>> >> > class loader, when we go to deploy the web app, we'll see them both
>> >> > because the EJB JAR is added to the parent classpath of the WAR.  Is
>> >> > there a good way to distinguish "resource in my ClassLoader" from
>> >> > "resources in my ClassLoader tree"?
>> >> >
>> >> > Thanks,
>> >> >     Aaron
>> >>
>>

Mime
View raw message