Multi threading on DMOs by lazy loading

#1

It is possible to use lazy loading on fields of attached entities by several threads?

Example:

class EntityZ {

    @OneToOne(fetch = FetchType.LAZY)
    EntityX fieldX;

    @OneToOne(fetch = FetchType.LAZY)
    EntityY fieldY;

    @ElementCollection (fetch = FetchType.LAZY)
    List<String> list;
}

We want to load the entity of type EntityZ from database.
Several threads use the identical instance of EntityZ.
Thread1 access fieldX by lazy loading.
Thread2 access fieldY by lazy loading.
Thread3 access list by lazy loading.

Does the multi threading access on different fields work correctly?

 

#2

It should work. If you experience any issue (e.g. a deadlock) please report.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login