Multi threading on DMOs by lazy loading


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


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?



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