JPA Cascade Parameters at Run Time

I am trying to create an application that maintains the object model in synchronization with the database, observing all the changes, and then immediately saving the objects in questions. Many objects in the model have children in large lists or trees.

When I load an object from the database, I rely on a one-way cascading relationship to also retrieve all its children and include them in the application.

However, you can change the field in the parent object that requires persistence, and I can determine that none of these children are affected. Therefore, I would like to save the parent without hitting the database with the entire cascading child.

eg,

@Entity
public class Parent {

    @OneToMany(cascade=CascadeType.ALL)
    public List children;

}

, Parent? REFRESH , ?

+5
1

.

, (FetchType.EAGER) , fetch .

JPA . EclipseLink QueryHint.BATCH, , .

, , .

, , .

, , .

JPA () . , , ?

? - ?

+4

All Articles