Can anyone tell me what's the difference between this code:
// This following method checks if there is an open session
// and if yes - returns it, if not - opens a new session.
Session session = getSession();
Query query = session.createQuery("from Entity e where e.id = 1");
Entity object = (Entity)query.uniqueResult();
and this:
Session session = getSession();
Entity object = (Entity)session.load(Entity.class, new Integer(1));
Does the first method return a proxy object? And if I call it again does it hit the database?