I\'m trying to get Hibernate @OneToOne annotations working and not having much success here...
Let\'s say I\'ve got a table called status that looks lik
use this way. Add below field in Customer entity.
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "customer")
private Status status;
and don't add getter and setter for status field in Customer entity. And add below code to Status Entity.
@OneToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "customer_id", nullable = false)
private Customer customer;
Here add the getter and setter for customer field in Status Entity class. You can see one working example here.