title: is this approach unidirectional or bidirectional
body: <p>Consider following entities</p>
  
  <p><strong>UserDetails (with Vehicles)</strong></p>
  
  <pre><code>@Entity
  public class UserDetails {
  
  @Id
  @GeneratedValue(strategy=GenerationType.AUTO)
  private int userId;
  private String userName;
  
  @OneToMany(mappedBy="user",cascade=CascadeType.ALL,orphanRemoval=true)
  private List&lt;Vehicle&gt; vehicleList = new ArrayList&lt;&gt;();
  
  //getter setters
  }
  </code></pre>
  
  <p><strong>Vehicle</strong></p>
  
  <pre><code>@Entity
  public class Vehicle {
  
  @Id 
  @GeneratedValue(strategy=GenerationType.AUTO)
  private int vehicleId;
  private String vehicleName;
  
  @ManyToOne
  @JoinColumn(name="user_id")
  private UserDetails user;
  
  //getter setters
  }
  </code></pre>
  
  <ol>
  <li><p>Why we should use the above <code>@OneToMany</code> code if we can achieve the same db tables using the code below? Is the use of <code>@OneToMany</code> here just giving a solution of accessing the vehicle from user side 
  and if i have no requirement of accessing the vehicle for any user , this is correct configuration?</p></li>
  <li><p>And since it gives same table configuration as bi-directional, what 
  should we say it uni-directional or bi-directional approach? I think as per code we cannot access vehicle from user side but user from vehicle side so is it a kind of uni-directional? </p></li>
  </ol>
  
  <p><strong>UserDetails (without Vehicle)</strong></p>
  
  <pre><code>@Entity
  public class UserDetails {
  
  @Id
  @GeneratedValue(strategy=GenerationType.AUTO)
  private int userId;
  private String userName;
  
  //getter setters
  }
  </code></pre>
  
  <p><strong>Table UserDetails</strong></p>
  
  <pre><code>mysql&gt; select * from userdetails;
  +--------+------------+
  | userId | userName   |
  +--------+------------+
  |        | First User |
  +--------+------------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p><strong>Table Vehicle</strong></p>
  
  <pre><code>mysql&gt; select * from vehicle;
  +-----------+-------------+---------+
  | vehicleId | vehicleName | user_id |
  +-----------+-------------+---------+
  |         2 | karizma     |         |
  |         3 | scooty-pep  |         |
  +-----------+-------------+---------+
  2 rows in set (0.00 sec)
  </code></pre>