dev@glassfish.java.net

Re: Faulty persistence loading

From: Jerome Dochez <Jerome.Dochez_at_Sun.COM>
Date: Wed, 01 Feb 2006 20:34:42 -0800

Bill Shannon wrote:
> The persistence spec provides a way to get a temp class loader.
> My understanding is that it is intended to be used exactly as
> you described, to discover the persistence classes before they're
> loaded "for real".
>
>> It seems to me we need to change the way persistence units are loaded
>> in the application server to the following :
>>
>> - open the archive
>> - create a temp class loader
>> - find all persistence units and initialize the
>> PersistenceProvider with each of them and get the ClassTransformer
>> from the provider
>> - initialize a new ClassLoader with the ClassTransformer to use
>> from now on
>> - process Java EE annotations
>> - load XML
>> - (deployment)
>> - load applications.
>>
>> When there are no persistence units in the deployment artifact, we
>> skip 2, 3 and 4
>
> I assume after step 1 you scan the archive for annotations and determine
> if there's a persistence unit based on whether there are any classes
> with the @Entity annotation, or there's a persistence.xml file.
yes this is correct, hopefully we would be able to use my scanner and
remain persistence provider agnostic.