title: Hibernate 4.2, JPA 2.0 Relationship OnetoMany Unidirectional with Annotations
body: <p>I'm starting my first project with Hibernate 4.2.21 and first with JPA 2.0, I want to create a relationship OneToMany Unidirectional. I saw a lot examples in version of Hibernate 3 but not much in 4.2.21 This example works perfectly but I don't know if is a good practice, I want to know the Opinion from another members about that?</p>
  
  <p>Relationship One To Many:</p>
  
  <p>-Parent Template:</p>
  
  <pre><code>  @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "template_id") 
    private Set&lt;Variable&gt; variables = new LinkedHashSet&lt;Variable&gt;();
  </code></pre>
  
  <p>-Child: Variable</p>
  
  <pre><code>@Column(name = "template_id", nullable = false)
  Integer templateId;
  </code></pre>