Because:
In hdm xml:
<generator class="native"></generator>
In department table:
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| name | varchar(20) | NO | | NULL | |
| depart_id | int(11) | NO | MUL | NULL | |
+-----------+-------------+------+-----+---------+-------+
id is not auto-increment
Action:
alter table department modify column id int NOT NULL AUTO_INCREMENT;
insert successfully.
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ejblover/archive/2010/01/21/5221791.aspx