1 Reply Latest reply on May 20, 2009 11:40 PM by Alexandros Karypidis

    Problem with form for entity with generated id

    Alexandros Karypidis Novice

      Hi,


      I'm using Seam 2.0.2.SP1 on JBoss 4.2.3 with a Sun 1.5.18 JDK.


      I have an entity with a generated id as follows:



              @Id
              @Column(name = "ENTITY_ID", unique = true, nullable = false)
              @NotNull
              public int getEntityId() {
                      return this.entityId;
              }
      



      When I use the form (generated by seam with reverse engineering from database) to create a new entity, hibernate tries to specify the entity id in the INSERT statement and the database (Apache Derby 10.4.2) throws an exception, complaining that Attempt to modify an identity column.


      I have manually removed the field for specifying the entity id from the form, but I suspect that seam inserts a default value (probably zero) there. How can I fix this?