title: Skip a column on INSERT with JPA
body: <p>I have a JPA/EclipseLink model with multiple parameters whose values are set as defaults by the PostgreSQL database. Specifically, I have:</p>
  
  <ul>
  <li>An <code>id</code> column of type <code>SERIAL</code> which auto-increments when new rows are added</li>
  <li>A <code>created_at</code> column of type <code>TIMESTAMP</code> which defaults to <code>now()</code></li>
  </ul>
  
  <p>My model looks like this:</p>
  
  <pre><code>import javax.persistence.*;
  
  @Entity
  @Table(name="entity")
  @NamedQuery(name="Entity.findAll", query="SELECT e from Entity e")
  public class Entity {
      @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
      private Integer id;
  
      @Column(name="created_at")
      private java.sql.Timestamp createdAt;
  
      // constructor, getters, and setters
  }
  </code></pre>
  
  <p>When I try to insert a row with <code>persist()</code> in <code>javax.persistence.EntityManager</code>, the insertion fails because a <code>NULL</code> value is being set for the <code>created_at</code> column. Rather than inserting <code>NULL</code>, I want to simply not insert anything into that column and allow PostgreSQL to set it to <code>now()</code>.  Essentially, I would like to use <code>@GeneratedValue</code> on <code>createdAt</code>, but that annotation is only for primary keys and cannot be used on multiple attributes. Is there another annotation I can use that will accomplish this?</p>