Hi,
I'm using Hibernate 2.1.1 with Mysql 3.23. I'm trying to autogenerate id's which are of type long.
When I try to insert a new record, I get the message:
java.sql.SQLException: Invalid argument value, message from server: "Duplicate entry '0' for key 1"
Here's the relevant portion of the mapping fille:
<id
name="id"
column="ID"
type="java.lang.Long"
>
<generator class="native">
</generator>
</id>
Here's the Java code which fails:
Transaction trans = session.beginTransaction();
p = new PersonImpl();
p.setName1( "aa" );
p.setName2( "bb" );
session.saveOrUpdate( p );
trans.commit();
I have ensured that the id attribute in the PersonImpl object is indeed null when it goes into saveOrUpdate.
Thanks in advance for any hints.
Michael
|