Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA cascade ?  RSS feed

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JPA + hibernate + Spring, but looks like the Cascade doesn't work.

Please see the coding, what I expect is, "John" is deleted, "Mary" is added. But I try all javax.persistence.CascadeType, it will NOT give me the result. Then I try to use org.hibernate.annotations.CascadeType, it will always give me syntax error.

Where is the problem ?

Thanks.

 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Does that tell Hibernate to delete the entity, or to just remove the association between the company and the employee? If you just deleted the Employee, rather than removing it from the list, the data would die. Thoughts?

-Cameron McKenzie
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!