openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: Processing multiple persistence-units
Date Fri, 28 Jul 2006 20:03:54 GMT
Funny, I was just talking about this very behavior a few minutes ago.

IMO, the correct behavior should be:

- PCEnhancer run with no arguments should load all the PUs in the
classpath, find the OpenJPA (or unspecified) PUs, and run against all
the classes defined by those PUs (including auto-scanning for PUs so
configured).

- The developer should not need to specify META-INF/persistence.xml when
invoking the PCEnhancer.

- We may want to provide a means to specify specific PUs to process. For
example: 

  java ...PCEnhancer -p META-INF/persistence.xml#foo

or maybe just 

  java ...PCEnhancer -p #foo

for shorthand.

Regardless, the current behavior seems wrong, and it seems that the best
initial change would be to make PCEnhancer load all the PUs (the first
bullet above), which means manually loading the META-INF/persistence.xml
resources and finding the ones that are OpenJPA PUs, rather than relying
on the javax.persistence.Persistence helper method to load them.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc.  

> -----Original Message-----
> From: Kevin Sutter [mailto:kwsutter@gmail.com] 
> Sent: Friday, July 28, 2006 12:53 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Processing multiple persistence-units
> 
> Hi,
> According to the JPA spec, we can define multiple 
> persistence-units in a single persistence.xml file.  But, 
> when I try to use this persistence.xmlfile as input to the 
> PCEnhancer, it is only processing the first persistence-unit 
> that is defined.  I traced through the code and found that 
> this is the case.  When the persistence.xml file is 
> processed, a "null" name is passed in for the desired 
> persistence-unit (in the ConfigurationProviderImpl.load 
> method) and, thus, only the first one defined is returned and 
> used by the PCEnhancer.
> 
> My question is whether this is working "as designed"?.  Or, 
> is there more code to drop to resolve this problem?  Or, is 
> my interpretation of the spec inconsistent with yours?
> 
> Thanks,
> Kevin
> 
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Mime
View raw message