8000 [DE-805] A way to check if a LazyLoadingProxy entity has been resolved · Issue #271 · arangodb/spring-data · GitHub
[go: up one dir, main page]

Skip to content

[DE-805] A way to check if a LazyLoadingProxy entity has been resolved #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mcso opened this issue Mar 16, 2023 · 3 comments
Closed

[DE-805] A way to check if a LazyLoadingProxy entity has been resolved #271

mcso opened this issue Mar 16, 2023 · 3 comments
Assignees

Comments

@mcso
Copy link
mcso commented Mar 16, 2023

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.

@rashtao rashtao self-assigned this Apr 4, 2023
@rashtao
Copy link
Collaborator
rashtao commented Apr 4, 2023

Thanks for reporting, we can implement this by exposing the resolved field:

in LazyLoadingProxy.

@mdmm13
Copy link
mdmm13 commented Feb 8, 2024

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 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
@rashtao
Copy link
Collaborator
rashtao commented Jun 21, 2024

@rashtao rashtao closed this as completed Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0