1>When we start an application, or the first time we open a hibernate session the COnfiguration factory would take care to load all the entity classes into memory based on the configuration files.Am i wrong here? or are the entity loaded only as and when required based on lazy initialization property?
2>However I would like to know if this happens, when are the entity classes garbage collected? if the application holds no references to the entity classes outside the DAO layer, are the entity classes garbage collected on closing the session? Just like it happens with jdbc ResultSet objects on closing a jdbc connection?
3> If so does it mean, on consequent opening of a session, all the entity classes loaded again?
what will CustomHibernateSessionWrapper.getSession() perform? will it configure all the cfg files again?
Would it be an elegant solution if i check if an existing session exists, then return the same, if not open a new one.