title: How to exclude an entity field when doing an update with JPA
body: <p>Is there a way to make a field non-persistent at update operation but persistent at create operation with JPA - Hibernate 4?</p>
  
  <p>I tried it in this way</p>
  
  <pre><code>@Transient
  @Id
  @Column(name = "USER_NAME", nullable = false, length = 75)
  private String userName;
  </code></pre>
  
  <p>but with @Transient annotation the field will be transient across all CRUD operations and I want a way to specify that only on this operation is persistent (create).</p>
  
  <p>Is there a way to do this?</p>
  
  <p>Thanks!</p>