2 Replies Latest reply on Sep 13, 2005 4:23 PM by pipo

    Primary key generator

    pipo Newbie

      Hi,
      I have a simple entity bean with the primary key generated by a sequence. My annotatios are:

      ...
      @Entity
      @SequenceGenerator(name = "seq_gen", sequenceName = "service_seq")
      @Table(name = "service")
      public class Service implements Serializable {
      ...

      ...
      @Id(generate = GeneratorType.SEQUENCE, generator = "seq_gen")
      @Column(name = "ID")
      public int getId() {
      ...

      My database is postgres and when I create a simple entity the sql that container generates to obtain the primary key is:

      ...
      [org.hibernate.SQL] select next value for service_seq from dual_service_seq
      ...

      This sentence is wrong in postgresql.

      Can you help me.
      Very thank you.