EmptyModel with initializeEntity
In https://gitlab.croptrust.org/grin-global/grin-global-server/-/merge_requests/252#note_55780 we discussed the Hibernate.initialize()
in lazyLoad()
. With this method, we don't even need checking on null
.
we add that
initializeEntity(Object proxy)
to our super model (AuditedModel
orEmptyModel
) and make itprotected
? Then just callinitializeEntity(this.counterCooperator);
In this ticket do the following:
class EmptyModel {
protected final void initializeEntity(Object proxy) {
Hibernate.initialize(proxy);
}
}
class InventoryViabilityData {
lazyLoad() {
initializeEntity(this.inventoryViability);
...
}
}
If that works, all lazyLoads
can be updated with initializeEntity()
instead of .getId()
.