2 Replies Latest reply on Feb 25, 2008 8:17 PM by keithnaas

    How to insert data into database more than one time ?

    sart

      Hello!
      I found that i can't persist data more than one time for a single entity. I know that i must create new entity instance every time i want to make persist. But in seam it's not working because i use @In annotation. So what should i do ?


      I would appreciate any help !


      this is my entity..


      package com.st.st;
      
      import java.util.Date;
      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import static javax.persistence.GenerationType.IDENTITY;
      import javax.persistence.Id;
      import javax.persistence.Table;
      import org.hibernate.validator.NotNull;
      import org.jboss.seam.annotations.Name;
      
      
      @Entity
      @Table(name = "schedule", catalog = "seamtest")
      @Name("schedule")
      public class Schedule implements java.io.Serializable {
      
           private Integer scheduleId;
           private float value;
           private Date date;
      
           public Schedule() {
           }
      
           public Schedule(float value, Date date) {
                this.value = value;
                this.date = date;
           }
      
           @Id
           @GeneratedValue(strategy = IDENTITY)
           @Column(name = "schedule_id", unique = true, nullable = false)
           public Integer getScheduleId() {
                return this.scheduleId;
           }
      
           public void setScheduleId(Integer scheduleId) {
                this.scheduleId = scheduleId;
           }
      
           @Column(name = "value", nullable = false, precision = 12, scale = 0)
           @NotNull
           public float getValue() {
                return this.value;
           }
      
           public void setValue(float value) {
                this.value = value;
           }
      
           @Column(name = "date", nullable = false, length = 0)
           @NotNull
           public Date getDate() {
                return this.date;
           }
      
           public void setDate(Date date) {
                this.date = date;
           }
      
      }