@ForeignKey in Hibernate 3.5-beta1
3 answers
The annotations / EntityManager will be bundled with the Hibernate Core 3.5.x release ; either beta1 doesn't clarify as a release, or it's screwed up in some way, but it does NOT contain annotations or EntityManager.
You need to download them separately:
and add the appropriate JARs to your classpath.
+1
source to share
Hibernate allows you to persist the foreign key name. Hibernate overrides the foreign key name @ForeignKey. It has an attribute name that needs to be defined.
@Entity
@Table(name = "state")
public class State {
@Id
@Column(name = "id")
private int id;
@Column(name = "name")
private String name;
@ManyToOne
@ForeignKey(name="FK_COUNTRY")
private Country country;
}
0
source to share