Sinds JPA 2.1 kunt u de @ gebruiken javax.persistence.ForeignKey annotatie:
@OneToOne()
@JoinColumn(name="vehicle_id", referencedColumnName="vehicleId", [email protected](name = "Fk_userdetails_vehicle"))
public Vehicle getVehicle() {
return vehicle;
}
Vóór JPA 2.1 kon je Hibernate's @org.hibernate.annotations.ForeignKey annotatie, maar deze is nu verouderd:
@OneToOne()
@JoinColumn(name="vehicle_id", referencedColumnName="vehicleId")
@ForeignKey(name="Fk_userdetails_vehicle")
public Vehicle getVehicle() {
return vehicle;
}