@Column(unique = true)
private String name;
是无用的,因为http://stackoverflow.com/questions/3496028/columnunique-true-does-not-seem-to-work
Any对象只能是单向的,One-to-Many不行。
@Entity(name = "brand")
这样的写法是错误的,会报错:org.hibernate.hql.ast.QuerySyntaxException: Brand is not mapped [from Brand]
正确的写法是:
@Entity
@Table(name = "brand")
private String name;
是无用的,因为http://stackoverflow.com/questions/3496028/columnunique-true-does-not-seem-to-work
Any对象只能是单向的,One-to-Many不行。
@Entity(name = "brand")
这样的写法是错误的,会报错:org.hibernate.hql.ast.QuerySyntaxException: Brand is not mapped [from Brand]
正确的写法是:
@Entity
@Table(name = "brand")