CascadeType « JPA « Spring Q&A

1. CascadeType.Persist does not work as expected

I have the following code (simplified of course):

 public class Foo {
   private Long id;
   private Collection<Bar> ...

2. Using CascadeType in Hibernate

I m working with Hibernate + Spring and JSF I have a problem when I use a relationship like @OneTomany in Hibernate. For example:

@Table(name = "book")
public class Book {


3. CascadeType.ALL does not remove

Hi all, I have two entities related to each other. a Tree entity Code: @Entity public class Tree { @Id private Long id; private String name; @OneToMany(cascade=CascadeType.ALL) private List leafs; } ...

4. How does CascadeType.All work under the covers

How does CascadeType.All work under the covers I have a parent child relationship Parent Entity Child Entity, when I persist the child enity I wish to persist the parent. childEntity.persist() As ...