本来在另一个项目用的好好的代码段
在新项目就出错了。 查了一下才知道 有两个同名的annotation的,我用错了
http://stackoverflow.com/questions/5719571/what-am-i-missing-for-using-hibernate-annotation
There are two sets of persistence annotations (@Entity and @Table) - JPA
annotations (in package javax.persistence) and Hibernate annotations
(in package org.hibernate.annotations). Note that example uses JPA
annotations, whereas your code uses Hibernate annotations, so your code
doesn't compile because these annotations have different sets of
attributes.
So, you need to change packages in your import statements.
Usually you should use JPA annotations unless you need some features provided only by Hibernate annotations.