You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by bongosdude <bo...@gmail.com> on 2009/02/12 04:55:57 UTC

OpenJPA problems with multi persistence.xml

I posted this problem on openjpa forum: Please see this thread at:

http://n2.nabble.com/Problem-with-multi-persistence-units-td2303818.html#a2304438


One of OpenJPA developer replied to my post and pointed out some problem
that may be caused by how geronimo configures openjpa. I copied his reply
here and hope someone from geronimo developers can comment

Hi, 
It looks like Geronimo might be passing in some extra properties to 
OpenJPA???  In the trace, there are two openjpa properties that are 
suspect.  You don't have them in your persistence.xml.  And, if you are not 
passing them in as system properties, then my next guess is Geronimo.  The 
two properties that seem to be causing your situation are these: 

openjpa.MetaDataFactory: 
jpa(Files=/usr/local/geronimo- 
tomcat6-javaee5-2.1.3/repository/default/callingcard-ear/1.0/callingcard-ear-1.0.car/callingcard-ejb.jar) 

openjpa.jdbc.SynchronizeMappings: buildSchema(ForeignKeys=true) 

The first one (MetaDataFactory) specifies which persistence types to 
process.  Since a jar file is specified, we will search the jar file for any 
persistence types (regardless of whether they are listed in a 
persistence.xml file or not).  Our documentation explains this a bit more 
[1]. 

The next property (SynchronizeMappings) is what I was referring to in 
earlier e-mails.  This is the property that tells OpenJPA to please create 
the tables if they do not exist. 

You can see in the trace that DigitalkUser and DigitalkAccount are being 
processed since they exist in the jar file specified in the MetaDataFactory 
property: 

124910  CallingCardUsersUnit  TRACE  [ejbd 1] openjpa.MetaData - Scan of 
"/usr/local/geronimo-tomcat6- 
javaee5-2.1.3/repository/default/callingcard-ear/1.0/callingcard-ear-1.0.car/callingcard-ejb.jar" 
found persistent types 
[com.nuvoip.services.ipcalls.model.entity.subscribers.DigitalkAccount]. 

Bottom line, you need to determine how those properties are being passed 
into OpenJPA.  We're just doing what's being requested...  :-) 

Good luck, 
Kevin 

[1] 
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_meta_factory



-----
B Amigo:super:
-- 
View this message in context: http://www.nabble.com/OpenJPA-problems-with-multi-persistence.xml-tp21969527s134p21969527.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: OpenJPA problems with multi persistence.xml

Posted by David Jencks <da...@yahoo.com>.
On Feb 12, 2009, at 11:43 AM, bongosdude wrote:

>
> Hi Kevan
>
> How is the property:
> openjpa.MetaDataFactory default setting. The default setting that  
> comes with
> geronimo causes openjpa to detect model from classes in the jar file
> regardless of the persistence.xml
>
> What should I do to make openjpa look in the persistence.xml for  
> classes
> assigned to each persistence unit.
  I think that openjpaMetaDataFactory is an internal name for the list  
of jar files that is the alternative to the explicit list of  
persistent classes.

I'm not entirely clear on what you want.  I would recommend listing  
all your persistent classes explicitly and specifying <exclude- 
unlisted-classes>true</exclude-unlisted-classes>  I haven't looked at  
this in a long time but IIRC <exclude-unlisted-classes/> is the same  
as "false"

thanks
david jencks

>
>
> Please help
>
> Thank
> -B
>
> kevan wrote:
>>
>>
>> On Feb 11, 2009, at 10:55 PM, bongosdude wrote:
>>
>>>
>>> I posted this problem on openjpa forum: Please see this thread at:
>>>
>>> http://n2.nabble.com/Problem-with-multi-persistence-units-td2303818.html#a2304438
>>>
>>>
>>> One of OpenJPA developer replied to my post and pointed out some
>>> problem
>>> that may be caused by how geronimo configures openjpa. I copied his
>>> reply
>>> here and hope someone from geronimo developers can comment
>>>
>>> Hi,
>>> It looks like Geronimo might be passing in some extra properties to
>>> OpenJPA???  In the trace, there are two openjpa properties that are
>>> suspect.  You don't have them in your persistence.xml.  And, if you
>>> are not
>>> passing them in as system properties, then my next guess is
>>> Geronimo.  The
>>> two properties that seem to be causing your situation are these:
>>>
>>> openjpa.MetaDataFactory:
>>> jpa(Files=/usr/local/geronimo-
>>> tomcat6-javaee5-2.1.3/repository/default/callingcard-ear/1.0/
>>> callingcard-ear-1.0.car/callingcard-ejb.jar)
>>>
>>> openjpa.jdbc.SynchronizeMappings: buildSchema(ForeignKeys=true)
>>>
>>> The first one (MetaDataFactory) specifies which persistence types to
>>> process.  Since a jar file is specified, we will search the jar file
>>> for any
>>> persistence types (regardless of whether they are listed in a
>>> persistence.xml file or not).  Our documentation explains this a bit
>>> more
>>> [1].
>>
>> I don't know where the MetatDataFactory setting is coming from... I
>> can't find anywhere where it is set by either Geronimo/OpenEJB. Maybe
>> I'm not looking in the right places.
>>
>>>
>>> The next property (SynchronizeMappings) is what I was referring to  
>>> in
>>> earlier e-mails.  This is the property that tells OpenJPA to please
>>> create
>>> the tables if they do not exist.
>>
>> Yes, that's our default setting for SynchronizeMappings. See var/
>> config/config.xml
>>
>> You can override by adding the following property in your
>> persistence.xml
>>
>> <property name="openjpa.jdbc.SynchronizeMappings" value="false" />
>>
>> --kevan
>>
>
>
> -----
> B Amigo:super:
> -- 
> View this message in context: http://www.nabble.com/OpenJPA-problems-with-multi-persistence.xml-tp21969527s134p21983451.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Re: OpenJPA problems with multi persistence.xml

Posted by bongosdude <bo...@gmail.com>.
Hi Kevan

How is the property: 
openjpa.MetaDataFactory default setting. The default setting that comes with
geronimo causes openjpa to detect model from classes in the jar file
regardless of the persistence.xml 

What should I do to make openjpa look in the persistence.xml for classes
assigned to each persistence unit.

Please help

Thank
-B

kevan wrote:
> 
> 
> On Feb 11, 2009, at 10:55 PM, bongosdude wrote:
> 
>>
>> I posted this problem on openjpa forum: Please see this thread at:
>>
>> http://n2.nabble.com/Problem-with-multi-persistence-units-td2303818.html#a2304438
>>
>>
>> One of OpenJPA developer replied to my post and pointed out some  
>> problem
>> that may be caused by how geronimo configures openjpa. I copied his  
>> reply
>> here and hope someone from geronimo developers can comment
>>
>> Hi,
>> It looks like Geronimo might be passing in some extra properties to
>> OpenJPA???  In the trace, there are two openjpa properties that are
>> suspect.  You don't have them in your persistence.xml.  And, if you  
>> are not
>> passing them in as system properties, then my next guess is  
>> Geronimo.  The
>> two properties that seem to be causing your situation are these:
>>
>> openjpa.MetaDataFactory:
>> jpa(Files=/usr/local/geronimo-
>> tomcat6-javaee5-2.1.3/repository/default/callingcard-ear/1.0/ 
>> callingcard-ear-1.0.car/callingcard-ejb.jar)
>>
>> openjpa.jdbc.SynchronizeMappings: buildSchema(ForeignKeys=true)
>>
>> The first one (MetaDataFactory) specifies which persistence types to
>> process.  Since a jar file is specified, we will search the jar file  
>> for any
>> persistence types (regardless of whether they are listed in a
>> persistence.xml file or not).  Our documentation explains this a bit  
>> more
>> [1].
> 
> I don't know where the MetatDataFactory setting is coming from... I  
> can't find anywhere where it is set by either Geronimo/OpenEJB. Maybe  
> I'm not looking in the right places.
> 
>>
>> The next property (SynchronizeMappings) is what I was referring to in
>> earlier e-mails.  This is the property that tells OpenJPA to please  
>> create
>> the tables if they do not exist.
> 
> Yes, that's our default setting for SynchronizeMappings. See var/ 
> config/config.xml
> 
> You can override by adding the following property in your  
> persistence.xml
> 
> <property name="openjpa.jdbc.SynchronizeMappings" value="false" />
> 
> --kevan
> 


-----
B Amigo:super:
-- 
View this message in context: http://www.nabble.com/OpenJPA-problems-with-multi-persistence.xml-tp21969527s134p21983451.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: OpenJPA problems with multi persistence.xml

Posted by Kevan Miller <ke...@gmail.com>.
On Feb 11, 2009, at 10:55 PM, bongosdude wrote:

>
> I posted this problem on openjpa forum: Please see this thread at:
>
> http://n2.nabble.com/Problem-with-multi-persistence-units-td2303818.html#a2304438
>
>
> One of OpenJPA developer replied to my post and pointed out some  
> problem
> that may be caused by how geronimo configures openjpa. I copied his  
> reply
> here and hope someone from geronimo developers can comment
>
> Hi,
> It looks like Geronimo might be passing in some extra properties to
> OpenJPA???  In the trace, there are two openjpa properties that are
> suspect.  You don't have them in your persistence.xml.  And, if you  
> are not
> passing them in as system properties, then my next guess is  
> Geronimo.  The
> two properties that seem to be causing your situation are these:
>
> openjpa.MetaDataFactory:
> jpa(Files=/usr/local/geronimo-
> tomcat6-javaee5-2.1.3/repository/default/callingcard-ear/1.0/ 
> callingcard-ear-1.0.car/callingcard-ejb.jar)
>
> openjpa.jdbc.SynchronizeMappings: buildSchema(ForeignKeys=true)
>
> The first one (MetaDataFactory) specifies which persistence types to
> process.  Since a jar file is specified, we will search the jar file  
> for any
> persistence types (regardless of whether they are listed in a
> persistence.xml file or not).  Our documentation explains this a bit  
> more
> [1].

I don't know where the MetatDataFactory setting is coming from... I  
can't find anywhere where it is set by either Geronimo/OpenEJB. Maybe  
I'm not looking in the right places.

>
> The next property (SynchronizeMappings) is what I was referring to in
> earlier e-mails.  This is the property that tells OpenJPA to please  
> create
> the tables if they do not exist.

Yes, that's our default setting for SynchronizeMappings. See var/ 
config/config.xml

You can override by adding the following property in your  
persistence.xml

<property name="openjpa.jdbc.SynchronizeMappings" value="false" />

--kevan