• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cascade Deletion

 
Marco Barenkamp
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

To simplify the situation, I will construct a simple example:
Consider, I have a Person that has addresses (bi-directional)



The problem is:
When I update an existing address or when I create a new address, I simply use the

method and everythink works as expected.
But when I delete an address the deletion is not detected by the EntityManager,
beause I cannot see any SQL statements when I call

Is this the intended bahaviour? I was expecting the address to be removed when merging the appropriate person.

Any comments?
I am using Sun App Server 9 (TopLink) for this example.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merging is for reattaching detached objects. Why aren't you calling persist to actually persist the change/deletion.

It depends, and it is explained in the Java Persistence with Hibernate book and also on the Hibernate website documentation page.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic