Hi,
I am trying to get the hibernate annotations working for my existing code. I have installed hibernate annotations libraries as mentioned in the tutorial and it was all working fine, but... when I try to create an entity in the database, I am getting the Unique Constraint Violated error.
I am using @Id @GeneratedValue(strategy=GenerationType.AUTO) for my primary key which is an Integer.
The table where I am trying to insert the data already have 4 rows in it, I have implemented this annotation now for the entity and trying to insert data using this, where I am getting this error. I have tried with all the strategies, but still I am stuck with this.
Can anyone please throw some light in here?
Hibernate version: 3.2
Full stack trace of any exception that occurs:
WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000
ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '0' for key 1
org.hibernate.exception.ConstraintViolationException: could not insert
Name and version of the database you are using: MySql Server 5
Thanks,
Karikalan
|