1 Reply Latest reply on Dec 30, 2005 9:21 PM by Emmanuel Bernard

    Entity(SequenceGenerator) with pgSQL

    cw YUEN Newbie

      JBoss ver 4.0.3SP1
      jboss-EJB-3.0_RC3
      pgsql 8.0.5


      my Entity bean code:


      package com.cherubim.ejb3.entity;
      
      import java.util.Collection;
      import javax.persistence.Entity;
      import javax.persistence.GeneratorType;
      import javax.persistence.Id;
      import javax.persistence.ManyToMany;
      import javax.persistence.SequenceGenerator;
      
      @Entity
      @SequenceGenerator(name="StudentSeq", sequenceName="STU_SEQ")
      public class Student implements java.io.Serializable
      {
       private int id;
       private String name;
       private float age;
       private Collection<Course> courses;
      
       @Id(generate=GeneratorType.SEQUENCE,generator="StudentSeq")
       public int getId()
       {
       return id;
       }
      
       public void setId(int id)
       {
       this.id = id;
       }
      
       public String getName()
       {
       return name;
       }
      
       public void setName(String name)
       {
       this.name = name;
       }
      
       public float getAge()
       {
       return age;
       }
      
       public void setAge(float age)
       {
       this.age = age;
       }
      }
      


      when i create a new record error message:
      org.apache.jasper.JasperException: null; CausedByException is:
       could not get next sequence value
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)



      My server log:
      [org.hibernate.util.JDBCExceptionReporter] could not get next sequence value [select next value for STU_SEQ from dual_STU_SEQ]
      org.postgresql.util.PSQLException: ERROR: syntax error at or near "value"