2015年4月9日 星期四

說明org.hibernate.HibernateException: Missing sequence or table: hibernate_sequence

org.hibernate.HibernateException: Missing sequence or table: hibernate_sequence

原因: DB宣告ID是自動遞增的,但entity沒指定這項設定 解法: 1.annotation的寫法 @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long id; 2.orm.xml的寫法 <entity name="Employee" class="org.acme.Employee" access="FIELD"> <attributes> <id name="id"> <generated-value strategy="IDENTITY"/> </id> </attributes> <entity/>

沒有留言:

張貼留言

Related Posts Plugin for WordPress, Blogger...