Try turning on show_sql to see what Hibernate is actually using. The error is fairly uncategorical so something must be setting the identity field. Hiebrnate itself should not be doing this I don't think.
Gopi Kiran Manusani
Joined: Nov 02, 2009
Here is my code..
Following it got printed in the console...
RoutingRUle ID: null
Hibernate: insert into tbRoutingRules (TeamID, TransactionEventType, Ordinal, Field, Operator, CompareValue, RouteToTeamID, RoutingRuleID) values (?, ?, ?, ?, ?, ?, ?, ?)Nov 2, 2009 6:47:59 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 544, SQLState: S0001
Nov 2, 2009 6:47:59 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Cannot insert explicit value for identity column in table 'tbRoutingRules' when IDENTITY_INSERT is set to OFF.
Nov 2, 2009 6:47:59 PM org.hibernate.event.def.AbstractFlushingEventListener performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: could not insert: [com.conagrafoods.merchstore.mappings.RoutingRules]
D'oh! Sorry should have spotted this straight away. You are using an increment generation strategy, not an identity generation strategy. So you are asking for Hibernate to generate a value for the primary key. You should change this to identity if that is what you want to use.