load() just returns a proxy by default and database won’t be hit until the proxy is first invoked.
what does it mean by proxy exactly here ?
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.
First of all, Proxy is a design pattern. In sense of Hibernate, it is dynamically subclassing your object at runtime. The proxy object will contain the same methods as your object(that’s why you don’t realize that you are dealing with a proxy), and as you say the database won’t be hit until the proxy is first invoked.