title: EJB/JPA: How to use EntityManager.persist() to always INSERT a new record, not update
body: <p>EntityManager.persist() function is trying to update a existing record, but I always need  to <strong>insert</strong> a new one. How to achieve this?</p>
  
  <p>Part of Entity bean:</p>
  
  <pre><code>@Entity
  @Table(name="SYNC_TRIGGER", schema="ETL")
  public class SyncTrigger implements Serializable {
  
      @Id
      @Column(name="ID")
      @SequenceGenerator(name = "TRIGGER_SEQ", sequenceName = "ETL.TRIGGER_SEQ")
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TRIGGER_SEQ")
      private Long triggerId;
  ......
  </code></pre>
  
  <p>Part of Stateless bean, which persists the record:</p>
  
  <pre><code>@Stateless
  public class TriggerPersister {
  
      @PersistenceContext(unitName="syncTriggerDS") 
      protected EntityManager entityManager;
  
      public &lt;T extends GenericTrigger&gt; void persistTrigger(SyncTrigger 
              st, T concreteTrigger){
  
              entityManager.persist(st);
  .........
  </code></pre>
  
  <p>UPD:
  Before entityManager.persist(st) is executed st.triggerId value is null, but after - id of previously added record is assigned to this field.</p>