You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Been playing around with the library, and has come across a situation for which I haven't found a solution for already.
When an object is a LazyLoadingProxy, it doesn't seem like there is a way to check if the entity has already been fetched from the database. Looking at AbstractResolver.ProxyInterceptor, there is a variable resolved which hold this state, but it is currently not exposed.
Is there a better way to check if the entity has been resolved, or can this be exposed through the LazyLoadingProxy interface?
This could be useful in situations like mapping with MapStruct (or other similar libaries) where a conditional mapping could be made, so it would only do the mapping if the entity has been resolved. Right now it will access the proxy object, which will trigger resolving the object from the database.
Hibernate's LazyInitializer has a similar method (isUninitialized()) for doing this kind of check.
I am using arangodb-spring-data version: 3.8.0.
The text was updated successfully, but these errors were encountered:
We've got the same issue where MapStruct causes tons of non-instantiated proxy objects to be called. This variable would greatly reduce the complexity of the checks.
rashtao
changed the title
A way to check if a LazyLoadingProxy entity has been resolved
[DE-805] A way to check if a LazyLoadingProxy entity has been resolved
Apr 23, 2024
Been playing around with the library, and has come across a situation for which I haven't found a solution for already.
When an object is a LazyLoadingProxy, it doesn't seem like there is a way to check if the entity has already been fetched from the database. Looking at AbstractResolver.ProxyInterceptor, there is a variable
resolved
which hold this state, but it is currently not exposed.Is there a better way to check if the entity has been resolved, or can this be exposed through the
LazyLoadingProxy
interface?This could be useful in situations like mapping with MapStruct (or other similar libaries) where a conditional mapping could be made, so it would only do the mapping if the entity has been resolved. Right now it will access the proxy object, which will trigger resolving the object from the database.
Hibernate's LazyInitializer has a similar method (
isUninitialized()
) for doing this kind of check.I am using arangodb-spring-data version: 3.8.0.
The text was updated successfully, but these errors were encountered: