0 Replies Latest reply on Mar 17, 2006 1:57 AM by wernera

    EntityManager.remove attemps DB update

    wernera

      I've come across the following issue when using an Entity Bean with a OneToMany relationship. If the JoinColumn has both insertable and updatable set to true, when I do an EntityManager.remove Hibernate attempts a DB update setting the columns to NULL rather than a delete. And as the table concerned has columns that are not nullable naturally this throws a JDBC/SQL error.

      Not sure why this happens as logically one would assume a remove is a delete rather than just setting the columns to NULL.

      Annotations used are below:

      @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
      @JoinColumn(name = "STAT_GRP_ID", insertable = true, updatable = true)

      The interesting thing is if updatable = false it functions as expected. If anyone out there can shed some light on this behaviour I will appreciate it.

      Thanks

      (I also posted this on the DB/Persistence forum but I think this may be a mor elogical place for my question)