|
version: Hibernate 3
db: MySql
dialect: org.hibernate.dialect.MySQLDialect
table creation:
create table if not exists myTable
( pk integer(10) unsigned not null auto_increment primary key,
name char(35),
) TYPE=INNODB;
mapping:
<hibernate-mapping>
<class name="com.MyObject" table="myTable">
<id name="pk" column="pk" type="java.lang.Long">
<generator class="native"/>
</id>
In my Pojo class, my primary key is using a java.lang.Long. When I run a simple select with hibernate, the field pk in my pojo would contain a value like 4294967297 instead of 1. If I change the type back to int in my mapping it sets pk to 1 which is fine. However I would like to use a Long in my Pojo. Can you clarify why this is happening and what to do? Sorry if thats a stupid question, I am new to Hibernate. Thanks.
|