@ForeignKey in Hibernate 3.5-beta1

I tried beta1 from Hibernate and the annotations should have been enabled, but when I use the JAR file I cannot find org.hibernate.annotations.ForeignKey or any ForeignKey annotation class inside the jar. Was it deprecated or renamed?

Greetings

Nick

+2


source to share


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


I think you need the hibernate-annotations jar I made with 3.2.1, so maybe you need that with 3.5-beta1 as well.



0


source


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







All Articles