Hello, I just started reading of JPA, and the implementation in hibernate to understand the details. but, to continue with development till then, can you help to clarify a basic qn.
When to use OneToOne
I may use OneToOne if the entity manager needs to handle the persistency of the related object. the point is, I can always live without specifying oneToOne, but then the responsibility is on me to manage the relationship and making sure that the referred objects are not in transient state. Is this true?When to use, or not to use, ManyToOne
Say I am defining an Employee class, and needs to define the rel with Employer. In this case, do I need to specify manyToOne like below, or what if not@Entity public class Employer { String name; }
@Entity class Employee { String name; @ManytoOne //or not?? Employer employer; }
thanks