I have a document entity mapped many to one to project entity.
When I call document.getProject, in debugger, in project field of document object I see something about Project$$EnhancerByCGLIB$$67a694bd.
How do I retrieve actual project object?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What You are seeing is the Hibernate-Proxy-Object, which enables hibernate to do lazy-instantiation.
First thing to ask yourself is, whether you really want to access the original object. Usually you should be better off pretending the proxy is your actual object and let hibernate do all the magic.
If for some reason you really need the object itself (e.g. if you need the exact type), the following code should work:
You should be aware that the result of abovewritten code will give you a detached object which is no longer under hibernate control, so changes to the object will not be synchronized with the database!