2 Replies Latest reply on Jul 20, 2011 4:47 AM by richyclarke

    NetBeans 7 generated entity classes conflict with Bean Validation

    richyclarke

      I am using NetBeans 7 to generate entity classes which I use in a Seam 3 application under JBOSS AS 7.


      The entity classes are generated with the following annotations... 


      public class Orders implements Serializable {
          private static final long serialVersionUID = 1L;
          @Id
          @GeneratedValue(strategy = GenerationType.IDENTITY)
          @Basic(optional = false)
          @NotNull
          @Column(name = "orderid")
          private Integer orderid;
      .....
      



      When persisting, bean validation fails because the autogenerated primary key is null at the time the object is persisted.


      Netbeans have stated that they wont fix this as they see it as bean validation issue rather than their generated classes. See http://netbeans.org/bugzilla/show_bug.cgi?id=197845


      Anyone else come across this - any workarounds? (other than disabling bean validation)


      Thanks in advance.
      Rich