刚写了一个Group类,一个Group类的映射,我是用XDoclet自动生成的映射文件.但是当我用save向数据库插入一条数据的时候,主键的值是一个很大的数:
-1.2E-105 ,2E100 ...之类,控制台打印的SQL代码如下 ,好象也没什么问题:
Hibernate: 
    select
        max(id) 
    from
        hl_t_group
Hibernate: 
    /* insert com.hl.website.domain.Group
        */ insert 
        into
            hl_t_group
            (name, parent_id, description, display_order, depth, create_date, id) 
        values
            (?, ?, ?, ?, ?, ?, ?)以下是我的实体类配置,请大家帮我看看?
/**
 * 分组实体类
 * @author 
 * @version  $date May 28, 2008   9:18:57 AM
 * @hibernate.class table="hl_t_group"
 */
public class Group implements Serializable
{
         /**
          * @hibernate.id generator-class="increment" unsaved-value="null" type="java.lang.Long" column="id"
          */
         private Long id;
/**
 * @hibernate.property column="name" 
 */
private String name;
/**
 * @hibernate.property column="parent_id" 
 */
private int parentId;
/**
 * @hibernate.property column="description"
 */
private String description;
/**
 * @hibernate.property column="display_order"
 */
private int displayOrder ;

/**
 * @hibernate.property column="depth"
 */
private int depth ; /**
 * @hibernate.property column="create_date"
 */
private Date createDate ; public Long getId() {
   return id;
        }        public void setId(Long id) { 
this.id = id;
        }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getDepth() {
return depth;
}
public void setDepth(int depth) {
this.depth = depth;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
} public int getDisplayOrder() {
return displayOrder;
}
public void setDisplayOrder(int displayOrder) {
this.displayOrder = displayOrder;
}
}
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping>
  <class table="hl_t_group" name="com.hl.website.domain.Group">
    <id type="java.lang.Long" column="id" unsaved-value="null" name="id">
      <generator class="increment"/>
    </id>
    <property name="name" column="name"/>
    <property name="parentId" column="parent_id"/>
    <property name="description" column="description"/>
    <property name="displayOrder" column="display_order"/>
    <property name="depth" column="depth"/>
    <property name="createDate" column="create_date"/>
  </class>
</hibernate-mapping>