I have an issue with my OpenJPA 2.0 based app, where I keep getting L1 cache
errors.

 

Basically I have a backing bean that retrieves a collection of entities and
retains them in a static list,  if I try to retrieve this list a second time
before the first load query has finished executing I will receive this stack
trace:

 

<openjpa-2.0.0-r422266:935683 nonfatal user error>
org.apache.openjpa.util.UserException: Cannot load object with id
"000001283E143CAE".  Instance
"com.trm.dataload.linetypes.DataLoadLine-000001283E143CAE" with the same id
already exists in the L1 cache.  This can occur when you assign an existing
id to a new instance, and before flushing attempt to load the existing
instance for that id.

FailedObject: com.trm.dataload.linetypes.DataLoadLine-000001283E143CAE

        org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:129)

 
org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4040)

 
org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:
384)

 
org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:
333)

 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreMan
ager.java:416)

 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.
java:342)

 
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreM
anager.java:112)

 
org.apache.openjpa.datacache.DataCacheStoreManager.initialize(DataCacheStore
Manager.java:347)

 
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreM
anager.java:112)

 
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57
)

 
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1005)

        org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:963)

 

The problem occurs because user1 will log in and retrieve this list since
the results of this query are displayed on their home page, while this query
is executing (because it takes a couple of minutes to complete the query)
user 2 logs in and executes the exact same query.

 

I don't see why it is a problem if this entity already exists in the L1
cache, I would have thought that was a good thing because the second user's
query would just use the cached version.

 

Can anyone explain ?

 

Thanks

 

Chris

 

Reply via email to