openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garpinc <>
Subject Re: Can someone explain this OpenJPA trace?
Date Wed, 19 Sep 2012 19:56:31 GMT
q.toString returns:

SELECT a FROM AnzoURIToPKImpl a WHERE (a.uriHash = :param AND a.typeUriHash
= :param)

and this is correct...

It turns out the statement
SELECT t0.datasetUri, t0.datasetUriHash, t0.persistedFully, t0.typeUri,
t0.typeUriHash, t0.uri, t0.uriHash FROM FILM.anzouritopk t0 WHERE = ?
[params=(long) 0]

occurs when entityManager.persist(ObjectToPersist) is called.. where obj has
a primary key of anzouritopk object where pk is not yet populated because
it's a generated value.

To illustrate

here is mapping for AnzoURITOPK id column:
    @Column(updatable = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getPk() {
        return pk;

Following the code path
return persistInternal(obj, id, explicit, call, fireEvent); in on line 2571 is called
id == null at line 2639
meta.getIdentityType() is ClassMetaData.ID_APPLICATION
at line 2651 id is now 0
bad select occurs on line 152 as below in stack trace.

Here is stack trace
FinderQueryImpl.execute(OpenJPAStateManager, StoreManager,
FetchConfiguration) line: 152	
JDBCStoreManager.getInitializeStateResult(OpenJPAStateManager, ClassMapping,
JDBCFetchConfiguration, int) line: 537	
JDBCStoreManager.initializeState(OpenJPAStateManager, PCState,
JDBCFetchConfiguration, ConnectionInfo) line: 349	
JDBCStoreManager.initialize(OpenJPAStateManager, PCState,
FetchConfiguration, Object) line: 304	
PCState, FetchConfiguration, Object) line: 112	
ROPStoreManager.initialize(OpenJPAStateManager, PCState, FetchConfiguration,
Object) line: 57	
FinalizingBrokerImpl(BrokerImpl).initialize(StateManagerImpl, boolean,
FetchConfiguration, Object) line: 1036	
FinalizingBrokerImpl(BrokerImpl).find(Object, FetchConfiguration, BitSet,
Object, int, FindCallbacks) line: 994	
FinalizingBrokerImpl(BrokerImpl).find(Object, FetchConfiguration, BitSet,
Object, int) line: 916	
FinalizingBrokerImpl(BrokerImpl).isDetached(Object, boolean) line: 4594	
FinalizingBrokerImpl(BrokerImpl).isDetached(Object) line: 4563	
SingleFieldManager.persist(OpCallbacks) line: 270	
StateManagerImpl.cascadePersist(OpCallbacks) line: 3045	
FinalizingBrokerImpl(BrokerImpl).persistInternal(Object, Object, boolean,
OpCallbacks, boolean) line: 2670	
FinalizingBrokerImpl(BrokerImpl).persist(Object, Object, boolean,
OpCallbacks, boolean) line: 2571	
FinalizingBrokerImpl(BrokerImpl).persist(Object, Object, boolean,
OpCallbacks) line: 2554	
FinalizingBrokerImpl(BrokerImpl).persist(Object, OpCallbacks) line: 2458	
DelegatingBroker.persist(Object, OpCallbacks) line: 1077	
EntityManagerImpl.persist(Object) line: 716	

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message