-
Notifications
You must be signed in to change notification settings - Fork 49
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
@Reference(lazy = true) still loading all references #91
Comments
can you follow this thread to verify it? On Wed, Jul 4, 2012 at 7:09 AM, Patrick Cullen <
|
Yes, I already did. I set breakpoints around the following line: user = User.find("byEmail", Security.connected()).first(); The result was that all references were run. |
Pardon my ignorance but there isn't a full source I could step through to help investigate, is there? I'm not sure of the contents of play-morphia.jar. |
the source you want to refer is morphia, not play-morphia. go On Wed, Jul 4, 2012 at 7:53 AM, Patrick Cullen <
|
I found that LazyFeatureDependencies is not being fulfilled once I traced the code which is causing it to ignore all lazy requests. I hope this helps. |
Also, just to elaborate on that above post, it looks as though the version of morphia that play-morphia is using is from April, 2011. From what I can gather this version of morphia has the hooks for lazy references but not the required dependencies. Here is the actual dependency check method: public static boolean testDependencyFullFilled() {
if (fullFilled != null)
return fullFilled;
try {
fullFilled = Class.forName("net.sf.cglib.proxy.Enhancer") != null
&& Class.forName("com.thoughtworks.proxy.toys.hotswap.HotSwapping") != null;
} catch (ClassNotFoundException e) {
fullFilled = false;
}
return fullFilled;
} |
One last note, I decided to see what would happen if I just added the missing proxytoys,jar and the whole thing blows up with : -Newer versions of morphia have lazy references working, would it be possible to update the version of morphia in the module? |
I took a quick swing at this today and tried adding the latest from morphia but that didn't seem to help (snapshot 99.1). I think it may be a conflict issue since play also uses CGLIB (but without the dependencies). I tried adding the dependencies found from this list: http://cglib.sourceforge.net/dependencies.html. I won't be able to commit any more time to this in the near future so I am reworking a bunch of code to use ObjectIds instead of @reference. You may want to warn that (lazy=true) does not work since play-morphia's documentation alludes to the option of using it. I wouldn't want anyone to get as far down the rabbit hole as I did... |
Adding the below to
which is slightly different from the project page's dependencies. Might we worth updating the dependencies.html to reflect it correctly. |
anandbn, it didnt work to me. This is my java method: public static void companies(String id) {
} Method start: So, even i only render comp.name both Company references (Account and Campaign) are fetched. Any ideas? |
Looks like this is an issue with Morphia itself: |
I have the following User class referenced members:
When I simply lookup the user by email it then queries for the organization and all of the organization's @references (which are lazy as well). Thank you in advance for any help and please let me know if there is any further code you will need.
The text was updated successfully, but these errors were encountered: