dev@glassfish.java.net

Re: Faulty persistence loading

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Wed, 01 Feb 2006 21:10:53 -0800

Jerome Dochez wrote On 02/01/06 20:34,:
> 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.

Only persistence.xml defines a persistent unit. @Entity might not mean
anything - it can be a non-managed client view or an excluded object.

-marina
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>