Home » Support » Issue Tracking » Lazy loading of mapped by (inverse) singular references

Lazy loading of mapped by (inverse) singular references

Type: Feature requestVersion: 2.0.0Priority: NormalStatus: FixedReplies: 1
#1

ObjectDB ignores lazy setting of non collection mapped by (inverse) fields and loads them always eagerly. This is allowed by JPA since lazy is only hint but it is not efficient.

The reason is that currently when an entity object is loaded all the referenced objects are instantiated immediately, at least as hollow objects. In order to instantiate referenced objects their exact type is needed. For ordinary reference fields the type of the references is stored within the entity objects, so it is always available. For mapped by (inverse) reference fields no information is stored in the entity object and therefore a query is required. The declared field type cannot be used since the referenced object may be an instance of a subclass.

Future versions of ObjectDB should manage mapped by (inverse) fields differently and avoid immediate instantiation. This will require managing in every entity object with inverse fields tracking which inverse fields have been loaded and references that have not been loaded yet will be set to null.

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

Lazy loading of mapped by (inverse) singular references is now supported in build 2.4.4_13.

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

Post Reply

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