0 Replies Latest reply on Nov 14, 2012 11:15 AM by Jiri Chaloupka

    Sequence for entity's generated ID is not commited

    Jiri Chaloupka Newbie


      I have JBoss AS 7 + PostgreSQL 9 as storage for entity beans with ID PK generated by db sequences. Works fine until app server restart - after restart entity got already used ID.

      When I look into db sequence, I see that it is not updated.


      My db datasource in configuration/standalone.xml is:

      <datasource jta="false" jndi-name="java:/PostgresDS" pool-name="PostgresDS" enabled="true" use-ccm="false">

















      I entity bean I have:


      @Table(name = "LogStep", schema = "public")

      @SequenceGenerator(name = "logstep_sequence", sequenceName = "LogStep_id_seq", allocationSize = 10, initialValue = 1)

      public class LogStep implements java.io.Serializable{


      private Integer id;




                @Column(name = "id", unique = true, nullable = false)

                @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "logstep_sequence")

                public Integer getId() {

                          return this.id;




      Could someone help me to find where is my mistake?