1 Reply Latest reply on Feb 9, 2006 4:37 PM by Emmanuel Bernard

    Auto-increment field disappears with update after setting th

    Daniel Hinojosa Master

      I found a weird little thing on my JBoss4.0.3SP1 and EJB 3.0 using mySQL 4.x.

      Lets say I had something like this in a bean called Order
      which I by the way DOES NOT HAVE an id that is autogenerated.
      and on the db I had auto_increment on OrderItems
      and all is right with the world.

      @OneToMany(mappedBy="order")
      public Set getOrderItems() {
      ....
      }

      Then I decided to add a cascade ALL
      @OneToMany(mappedBy="order", cascade=CascadeType.ALL)
      public Set getOrderItems() {
      ....
      }


      The auto_increment on the next deploy chucks out the auto_increment.
      Weird isn't it? has anyone seen this before?