Da JPA 2.1, puoi utilizzare @ javax.persistence.ForeignKey annotazione:
@OneToOne()
@JoinColumn(name="vehicle_id", referencedColumnName="vehicleId", [email protected](name = "Fk_userdetails_vehicle"))
public Vehicle getVehicle() {
return vehicle;
}
Prima di JPA 2.1, era possibile utilizzare @org.hibernate.annotations.ForeignKey annotazione, ma ora è obsoleta:
@OneToOne()
@JoinColumn(name="vehicle_id", referencedColumnName="vehicleId")
@ForeignKey(name="Fk_userdetails_vehicle")
public Vehicle getVehicle() {
return vehicle;
}