openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfriess <tfri...@de.ibm.com>
Subject Re: OpenJPA 1.2.2: Persisting/ Retrieving List<String> or other Java build-in types using @PersistentCollection
Date Thu, 12 May 2011 15:05:44 GMT

Rick Curtis wrote:
> 
> Tim -
> 
> Can you post your Entity and the full exception stack?
> 

Hello Rick,
thank you for your fast response.

I went through my code once again and I think I've found the problem,
it seems to be the FetchType of such an PersistentCollection.
When I annotate such a List<String> with
@PersistentCollection(fetch=FetchType.EAGER)
I get the following Exception thrown:

Exception in thread "main" <openjpa-1.2.2-r422266:898935 nonfatal general
error> org.apache.openjpa.persistence.PersistenceException: java.lang.String
incompatible with org.apache.openjpa.enhance.PersistenceCapable
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:894)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:793)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:986)
	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:278)
	at
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2413)
	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:272)
	at
org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
	at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:36)
	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1228)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:775)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:771)
	at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:255)
	at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:294)
	at testing.Test.main(Test.java:55)
Caused by: java.lang.ClassCastException: java.lang.String incompatible with
org.apache.openjpa.enhance.PersistenceCapable
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setInverseRelation(JDBCStoreManager.java:408)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:380)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
	at
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
	at
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:913)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:871)
	... 16 more


But if I use @PersistentCollection(fetch=FetchType.LAZY) or only
@PersistentCollection,
everything works fine. 

Does this mean that such a PersistentCollection only can be loaded "lazy" in
OpenJPA 1.x?
Or is there any way to load such a List "eager"?

Thank you!

Kind regards,
Tim

--
View this message in context: http://openjpa.208410.n2.nabble.com/OpenJPA-1-2-2-Persisting-Retrieving-List-String-or-other-Java-build-in-types-using-PersistentCollectn-tp6354895p6356104.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message