geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maho77 <m.hoffm...@mvolution.de>
Subject Re: EntityExistsException: Attempt to persist detached object
Date Tue, 27 Nov 2007 12:43:23 GMT



djencks wrote:
> 
> My experience is that to get openjpa sequences to work you NEED a non  
> transactional non-jta-datasource specified in your persistence.xml
> 
> 		<non-jta-data-source>yyyDataSouurce</non-jta-data-source>
> 
> where the configuration of yyyDataSouurce includes
> 
> <no-transaction/>
> 
> In particular it can't be the same datasource you use for the jta- 
> data-source
> 
> thanks
> david jencks
> 
> 

Hello,

thanks, I did it like you advised and I worked. But not as expected. I
received the following exception:
<openjpa-1.0.0-r420667:568756 nonfatal store error>
org.apache.openjpa.util.StoreException: Attempt to update the sequence table
"ID_GENERATOR" failed.  The sequence table is typically created when you run
the mappingtool's refresh action on any datastore identity class. If you
have not run the mappingtool but want to create the sequence table, run:
java org.apache.openjpa.jdbc.kernel.TableJDBCSeq -action add
at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3849)
	at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
	at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:75)
	at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:346)
	at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.nextInternal(TableJDBCSeq.java:247)
	at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:60)
	at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java:160)
	at
org.apache.openjpa.util.ImplHelper.generateFieldValue(ImplHelper.java:144)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField(JDBCStoreManager.java:557)
	at org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:450)
	at org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:426)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:541)
	at
org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
	at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:501)
	at
org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2770)
	at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
	at
org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:940)
	at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1884)
	at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1844)
	at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1762)
	at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:514)
	at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:499)
	at
org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:400)
	at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:257)
	at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:239)
	at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:140)
	at
org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:75)
	at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:219)
	at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
	at
org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:212)
	at
org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:120)
	at
org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
	at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
	at org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:73)
	at
org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
	at org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:117)
	at java.lang.Thread.run(Thread.java:810)

With this annotations in my entity:
	@TableGenerator(name="GroupIdGen", table="ID_GENERATOR",
pkColumnName="name", valueColumnName="id_value",
			pkColumnValue="group_table", allocationSize=1)
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE, generator="GroupIdGen")

and the table looks like this:
CREATE TABLE ID_GENERATOR (
	name VARCHAR(100) NOT NULL,
	id_value INTEGER UNSIGNED NOT NULL,
	PRIMARY KEY(name)
);

So according to this exception I changed the table to:
CREATE TABLE ID_GENERATOR (
	name0 VARCHAR(100) NOT NULL,
	id_value INTEGER UNSIGNED NOT NULL,
	PRIMARY KEY(name0)
);

And it worked without any changes in the annotation.

Can you explain this? Thank you very much.

Mark
-- 
View this message in context: http://www.nabble.com/EntityExistsException%3A-Attempt-to-persist-detached-object-tf4856534s134.html#a13970135
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message