niklassaers
niklassaers

Reputation: 8820

@ForeignKey in Hibernate 3.5-beta1

I tried out beta1 of Hibernate, and annotations were supposed to be included, yet when I use the JAR file I cannot find org.hibernate.annotations.ForeignKey nor any ForeignKey annotation class inside the jar. Has this been deprecated or renamed?

Cheers

Nik

Upvotes: 2

Views: 756

Answers (3)

Programming
Programming

Reputation: 1

Hibernate allows to keep foreign key name. Hibernate overrides the foreign key name by @ForeignKey. It has the attribute name that should 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;

}

Upvotes: 0

ChssPly76
ChssPly76

Reputation: 100736

Annotations / EntityManager will be bundled with Hibernate Core 3.5.x release; either beta1 does not clarify as release or somehow it got screwed up but it does NOT contain annotations or EntityManager.

You'll need to download them separately:

and add appropriate JARs to your classpath.

Upvotes: 1

Paul Whelan
Paul Whelan

Reputation: 16809

I think you need the hibernate-annotations jar I did with 3.2.1 so perhaps you need it with 3.5-beta1 too

Upvotes: 0

Related Questions