I understand session.load()
method in Hibernate.
Employee emp = (Employee) session.load(Employee.class, new Long(1));
Above will just return proxy, not hitting the database until any method is called on emp
object.
I read that if i call identifier i.e. emp.getId()
, then also no database call is made. But when I ran, it did call the database even though I have below in Employee class.
@Id
private Long id;
Please let me know what I am doing wrong.