Hi there
Actually I'm getting a very strange problem
I'm using JPA with Hibernate and DELETE_ORPHAN on @OneToMany relationships. Who makes my EntityManager and manages my transaction is Spring Framework.
I made some Unit/Integration tests and when I run they, everything works fine, exactly as I expected, even I use EXACLTY the configuration on web
but, when I use it on web, DELETE_ORPHAN doesn't work and I don't know what is happening. And other problem is, let's suppose this piece of code
Code:
public void removeElement( Element element ) {
element.setParent( null );
this.getElements().remove( element );
}
public void addElement( Element element ) {
element.setParent( this );
this.getElements().add( element );
}
As you can see, it's a common way to add/remove element on a relationship and, when I use merge() operation on EntityManager, my EntityManager must cascade the operations, right?
but I saw one crazy thing
if I execute this line
Code:
this.getElements().remove( element );
doesn't let my "element" object to be updated. In other words, if I change other property in "element" object, it won't update this property.
BUT, if I remove that line the "element" object will be updated
anybody got a similar situation like that?