Hi,
what is the right way to retry saving a new/transient object where saving failed before because of a not-null constraint on one of it's properties? When I simply set the property and pass the object again to session.saveOrUpdate() I get a StaleObjectStateException probably because the object got an ID assigend on the first try even if that try failed.
Sofar I couldn't find the right information in the docs or the forum.
Any help is appreciated. Thanks in advance.
Johan
Hibernate version:
3.03
Mapping documents:Code:
<hibernate-mapping default-access="field">
<class name="myModel.Entity">
<id access="field" unsaved-value="null" name="oid" type="java.lang.String" length="32">
<generator class="uuid"/>
</id>
<joined-subclass name="myModel.businessObjects.Attribute" table="pm_attribute">
<key column="oid"/>
<property name="name" access="field" not-null="true"/>
</joined-subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code for HibernateUtil:
http://www.koders.com/java/fidC083A93BA ... C9005.aspxCode:
public class MyHibernateDAO implements MyDAO
{
public void delete(Entity e)
{
HibernateUtil.getSession().delete(e);
}
public List getAll(Class< ? extends Entity> clazz)
{
return HibernateUtil.getSession().createCriteria(clazz).list();
}
public List get(Class< ? extends Entity> clazz, Criterion criterion)
{
return HibernateUtil.getSession().createCriteria(clazz).add(criterion).list();
}
public Entity get(Class< ? extends Entity> clazz, String oid)
{
return (Entity) HibernateUtil.getSession().get(clazz, oid);
}
public void save(Entity e)
{
HibernateUtil.getSession().saveOrUpdate(e);
}
}
Code:
public abstract class Entity
{
private String oid = null;
public final String getEntityOid()
{
return oid;
}
public String toString()
{
return getClass().getName() + "#" + oid;
}
}
Code:
public class Attribute extends Entity
{
private String name;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
Code:
public class ProductManagementTest extends TestCase
{
public void test()
{
try
{
MyDAO myDAO = new MyHibernateDAO();
Attribute a = new Attribute();
try
{
HibernateUtil.beginTransaction();
myDAO.save(a);
HibernateUtil.commitTransaction();
fail("myDAO.save() should have failed since name property of Attribute was not set");
}
catch (org.hibernate.PropertyValueException e)
{
e.printStackTrace();
HibernateUtil.rollbackTransaction();
}
// now set the name property to a non-null value and try saving again
try
{
HibernateUtil.beginTransaction();
a.setName("TEST");
myDAO.save(a);
HibernateUtil.commitTransaction();
}
catch (RuntimeException e)
{
HibernateUtil.rollbackTransaction();
e.printStackTrace();
fail("myDAO.save() unexpectedly failed ");
}
}
finally
{
HibernateUtil.closeSession();
}
}
}
Full stack trace of any exception that occurs:The expected PropertyValueException on the first try to save the object
org.hibernate.PropertyValueException: not-null property references a null or transient value: myModel.businessObjects.Attribute.name
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:235)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:159)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:464)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:459)
at myModel.dao.hibernate.MyHibernateDAO.save(MyHibernateDAO.java:37)
at myModel.test.AttributeTest.test(AttributeTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)The unexpected StaleObjectStateException on the second try to save the object
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [myModel.businessObjects.Attribute#8911707e03e51e7b0103e51e820e0001]
at org.hibernate.persister.entity.BasicEntityPersister.check(BasicEntityPersister.java:1431)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:726)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:320)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at myModel.dao.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:105)
at myModel.test.AttributeTest.test(AttributeTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
myModel.dao.hibernate.InfrastructureException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [myModel.businessObjects.Attribute#8911707e03e51e7b0103e51e820e0001]
at myModel.dao.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:112)
at myModel.test.AttributeTest.test(AttributeTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [myModel.businessObjects.Attribute#8911707e03e51e7b0103e51e820e0001]
at org.hibernate.persister.entity.BasicEntityPersister.check(BasicEntityPersister.java:1431)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:726)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:320)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at myModel.dao.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:105)
... 18 moreName and version of the database you are using:MySQL 4.1.7
The generated SQL (show_sql=true):Code:
Hibernate: update pm_attribute set name=? where oid=?
Debug level Hibernate log excerpt:
16.05.2005 13:04:40 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.3
16.05.2005 13:04:40 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
16.05.2005 13:04:40 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
16.05.2005 13:04:40 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
16.05.2005 13:04:40 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
16.05.2005 13:04:40 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
16.05.2005 13:04:41 org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: myModel/Entity.hbm.xml
16.05.2005 13:04:41 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: myModel.Entity -> Entity
16.05.2005 13:04:41 org.hibernate.cfg.HbmBinder bindJoinedSubclass
INFO: Mapping joined-subclass: myModel.businessObjects.Attribute -> pm_attribute
16.05.2005 13:04:41 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
16.05.2005 13:04:41 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
16.05.2005 13:04:41 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
16.05.2005 13:04:41 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
16.05.2005 13:04:41 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
16.05.2005 13:04:42 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
16.05.2005 13:04:42 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
16.05.2005 13:04:42 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
16.05.2005 13:04:42 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/mymodel?useUnicode=true&characterEncoding=8859_1&autoReconnect=true
16.05.2005 13:04:42 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=geheim}
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 4.1.7-nt
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.8 ( $Date: 2005/04/14 20:36:13 $, $Revision: 1.27.4.64 $ )
16.05.2005 13:04:42 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
16.05.2005 13:04:42 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
16.05.2005 13:04:42 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: null
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
16.05.2005 13:04:42 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {true=1, false=0}
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: enabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
16.05.2005 13:04:42 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
16.05.2005 13:04:42 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
16.05.2005 13:04:42 net.sf.ehcache.config.Configurator configure
WARNUNG: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/M$/eclipse-workspace/hibernateTest/lib/hibernate/ehcache-1.1.jar!/ehcache-failsafe.xml
16.05.2005 13:04:42 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
16.05.2005 13:04:42 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
16.05.2005 13:04:42 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
16.05.2005 13:04:42 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
16.05.2005 13:04:42 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
16.05.2005 13:04:42 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
16.05.2005 13:04:42 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
16.05.2005 13:04:43 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
16.05.2005 13:04:43 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
16.05.2005 13:04:43 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
16.05.2005 13:04:43 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: Running hbm2ddl schema export
16.05.2005 13:04:43 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: exporting generated schema to database
16.05.2005 13:04:43 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
16.05.2005 13:04:43 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
16.05.2005 13:04:43 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
16.05.2005 13:04:43 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/mymodel?useUnicode=true&characterEncoding=8859_1&autoReconnect=true
16.05.2005 13:04:43 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=geheim}
16.05.2005 13:04:43 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: schema export complete
16.05.2005 13:04:43 org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:mysql://localhost/mymodel?useUnicode=true&characterEncoding=8859_1&autoReconnect=true
16.05.2005 13:04:43 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
16.05.2005 13:04:44 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
16.05.2005 13:04:44 org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named queries
org.hibernate.PropertyValueException: not-null property references a null or transient value: myModel.businessObjects.Attribute.name
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:235)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:159)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:464)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:459)
at myModel.dao.hibernate.MyHibernateDAO.save(MyHibernateDAO.java:37)
at myModel.test.AttributeTest.test(AttributeTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
Hibernate: update pm_attribute set name=? where oid=?
16.05.2005 13:04:44 org.hibernate.event.def.AbstractFlushingEventListener performExecutions
SCHWERWIEGEND: Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [myModel.businessObjects.Attribute#8911707e03e52d520103e52d591d0001]
at org.hibernate.persister.entity.BasicEntityPersister.check(BasicEntityPersister.java:1431)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:726)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:320)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at myModel.dao.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:105)
at myModel.test.AttributeTest.test(AttributeTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
myModel.dao.hibernate.InfrastructureException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [myModel.businessObjects.Attribute#8911707e03e52d520103e52d591d0001]
at myModel.dao.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:112)
at myModel.test.AttributeTest.test(AttributeTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [myModel.businessObjects.Attribute#8911707e03e52d520103e52d591d0001]
at org.hibernate.persister.entity.BasicEntityPersister.check(BasicEntityPersister.java:1431)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:726)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:320)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at myModel.dao.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:105)
... 18 more