Hi,
I'm using Hibernate 2.1.1, JBoss 3.2.3 and Oracle 8.1.7.
I execute following code in session EJB method
Code:
Category category = (Category) session.load(Category.class,categoryOid);
suggestion = new Suggestion();
category.addSuggestion(suggestion);
Comment comment = new Comment();
suggestion.addComment(comment);
session.flush();
and get StaleObjectStateException in last line (flush method).
I'm the only user of this db so I don't understand the reason for this exception.
Hibernate log is
Quote:
[net.sf.hibernate.impl.SessionImpl] executing flush
[net.sf.hibernate.persister.EntityPersister] Inserting entity: [com.valuecommerce.sbox.hibernate.Suggestion#47]
[net.sf.hibernate.persister.EntityPersister] Version: 2004-01-14 15:16:04.974
[net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[net.sf.hibernate.SQL] insert into SB_SUGGESTION (INS_DATE, CATEGORY_OID, OID) values (?, ?, ?)
[net.sf.hibernate.impl.BatcherImpl] preparing statement
[net.sf.hibernate.persister.EntityPersister] Dehydrating entity: [com.valuecommerce.sbox.hibernate.Suggestion#47]
[net.sf.hibernate.type.TimestampType] binding '14 January 2004 15:16:04' to parameter: 1
[net.sf.hibernate.type.LongType] binding '10' to parameter: 2
[net.sf.hibernate.type.LongType] binding '47' to parameter: 3
[net.sf.hibernate.impl.BatcherImpl] Adding to batch
[net.sf.hibernate.persister.EntityPersister] Inserting entity: [com.valuecommerce.sbox.hibernate.Comment#61]
[net.sf.hibernate.persister.EntityPersister] Version: 2004-01-14 15:16:05.024
[net.sf.hibernate.impl.BatcherImpl] Executing batch size: 1
[net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 0
[net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[net.sf.hibernate.impl.BatcherImpl] closing statement
[net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[net.sf.hibernate.SQL] insert into SB_COMMENT (INS_DATE, SUGGESTION_OID, OID) values (?, ?, ?)
[net.sf.hibernate.impl.BatcherImpl] preparing statement
[net.sf.hibernate.persister.EntityPersister] Dehydrating entity: [com.valuecommerce.sbox.hibernate.Comment#61]
[net.sf.hibernate.type.TimestampType] binding '14 January 2004 15:16:05' to parameter: 1
[net.sf.hibernate.type.LongType] binding '47' to parameter: 2
[net.sf.hibernate.type.LongType] binding '61' to parameter: 3
[net.sf.hibernate.impl.BatcherImpl] Adding to batch
[net.sf.hibernate.impl.BatcherImpl] Executing batch size: 1
[net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 0
[net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[net.sf.hibernate.impl.BatcherImpl] closing statement
[net.sf.hibernate.persister.EntityPersister] Updating entity: [com.valuecommerce.sbox.hibernate.Suggestion#47]
[net.sf.hibernate.persister.EntityPersister] Existing version: 2004-01-14 15:16:04.974 -> New version: 2004-01-14 15:16:05.076
[net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[net.sf.hibernate.SQL] update SB_SUGGESTION set INS_DATE=?, CATEGORY_OID=? where OID=? and INS_DATE=?
[net.sf.hibernate.impl.BatcherImpl] preparing statement
[net.sf.hibernate.persister.EntityPersister] Dehydrating entity: [com.valuecommerce.sbox.hibernate.Suggestion#47]
[net.sf.hibernate.type.TimestampType] binding '14 January 2004 15:16:05' to parameter: 1
[net.sf.hibernate.type.LongType] binding '10' to parameter: 2
[net.sf.hibernate.type.LongType] binding '47' to parameter: 3
[net.sf.hibernate.type.TimestampType] binding '14 January 2004 15:16:04' to parameter: 4
[net.sf.hibernate.StaleObjectStateException] An operation failed due to stale data
Thanks.