Get identifiers from uninitialized persistent collection

I had a situation where I could not find an answer to viewing the Hibernate API documentation or on SO.

We have a disabled setting, and we send entities and collections back through the wire. We are considering how to use a localized cache to reduce some wired traffic, and I'm trying to figure out if there is a way to get the identifiers of objects in a persistent collection (in particular, PersistentSet) without initializing the set

+3
source share
1 answer

No, it can not be; PersistentCollection does not contain identifiers of related objects - if this were its purpose, it would be a regular collection containing lazy proxy downloads for related identifiers.

Membership verification usually requires an additional query or join (the foreign key is not in the same table as the primary key ...), which is expensive enough to merit the opportunity to postpone the download. This object is a permanent collection.

+2
source

Source: https://habr.com/ru/post/1775261/


All Articles