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)


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3930881#3930881

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3930881


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to