openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: Merging modular persistence units
Date Tue, 29 Mar 2011 13:49:41 GMT
> Is there a way to provide the openjpa loadtime enhancer with locations of
multiple persitence xml files in the classpath so that it enhances the
classes declared in all of these?
I scanned the code quickly and I don't believe so.


> this is the enhancement strategy I have to adopt for reasons beyond the
scope of this post
I don't want to get this post off track, but I am interested in hearing what
the problems were that you encountered with build time enhancement.

Now down to my recommendation. This advise assumes that you're using the
-javaagent for enhancement.?

You could create a "root" persistence unit in the default
location(META-INF/persistence.
xml) that will be used only for enhancement. If you do not list any
persistent types in the <class> list, we will enhance all Entities that are
encountered at load time. I think this approach should work for you... just
as long as you don't have different openjpa.DetachState settings across your
persistence units.

-javaagent:[path-to-openjpa-jar].jar=p=META-INF/persistence.xml#enhance-pu

Thanks,
Rick


On Tue, Mar 29, 2011 at 4:26 AM, paulvitic <paulv@vektortelekom.com> wrote:

> Hi,
>
> I am using openjpa 1.2.2 with spring. My project has multiple units that
> have entity classes. I wanted to be able to declare my persistence units in
> persistence.xml files within their own packages and merge these at runtime.
> There is a nice article that demonstrates how to do this.
> (
> http://labs.bsb.com/2010/11/configuring-modular-jpa-applications-with-spring/
> )
> which works except that when I try to enhance my classes at loadtime with
> openjpa enhancer (this is the enhancement strategy I have to adopt for
> reasons beyond the scope of this post) I run into trouble.
>
> The problem seems to be that at classload time openjpa enhancer is not
> aware
> of the persistence classes that will later going to be found by spring and
> it only checks what is available on the running applications
> META/persistence.xml file. Since the application does not support
> RuntimeUnenhancedClasses this later causes error.
>
> Is there a way to provide the openjpa loadtime enhancer with locations of
> multiple persitence xml files in the classpath so that it enhances the
> classes declared in all of these?
>
> Thank you.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message