The problem is presumably that the identities assigned from the sequence Manager are not immediately visible to the JDO layers.
You could avoid these problems by explicitely triggering computing the sequence numbers *before* making the objects persistent.
lManager.currentTransaction().begin();
new Identity(lA1);
lManager.makePersistent( lA1);
lManager.currentTransaction().commit(); lManager.currentTransaction().begin();
new Identity(lA2);
lManager.makePersistent( lA2);
lManager.currentTransaction().commit();cheers, Thomas
Lennart Benoot wrote:
Hi all,
I have an jdo enabled object that has an primary key id generated by a mysql auto incremented integer. Therefore i use the "org.apache.ojb.broker.util.sequence.SequenceManagerMySQLImpl" SequenceManager. I tried to disable the cache by setting: lFactory.setIgnoreCache( true); lFactory is the PersistenceManagerFactory.
Then i executed the following code: (lA1 and lA2 are two valid objects)
lManager.currentTransaction().begin();
lManager.makePersistent( lA1);
lManager.currentTransaction().commit();
lManager.currentTransaction().begin();
(*) lManager.makePersistent( lA2);
lManager.currentTransaction().commit();
the following exeption is throws at (*) :
javax.jdo.JDOUserException: Object exists. Instance with the same primary key is already in the PersistenceManager cache.
at com.sun.jdori.common.CacheManagerImpl.register(Unknown Source)
at com.sun.jdori.common.PersistenceManagerImpl.register(Unknown Source)
at com.sun.jdori.common.state.StateManagerImpl.initializeSM(Unknown Source)
at com.sun.jdori.common.state.StateManagerImpl.makePersistent(Unknown Source)
at com.sun.jdori.common.CacheManagerImpl.makePersistent(Unknown Source)
at com.sun.jdori.common.PersistenceManagerImpl.makePersistentInternal(Unknown Source)
at com.sun.jdori.common.PersistenceManagerImpl.makePersistent(Unknown Source)
at com.sun.jdori.common.PersistenceManagerWrapper.makePersistent(Unknown Source)
at axelera.gui.model.messaging.adaptor.AdaptorHome.main(AdaptorHome.java:145)
What wrong here?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
