I have no DAO service layer in a spring MVC project. IN my controller, I wish to create a criteria query. For this I need a session object to call the “createCriteria(myClass.class)”.
How do I get the session object ?
I saw some people were using the HibernateUtil class like “HibernateUtil.currentSession()”. I tried this but the import cannot be resolved. I posted some of the relvant code to address another issue here Hibernate criteria queries – Query Conditions
Can someone please offer some form of guidance in this regard, Thanks.
Ok, the problem was solved by using the entity manager exposed in the parent entity class. I have a class called person and in there is placed a transient method as follows
The main thing is how the HibernateEntityManager and the Session was obtained. Hope this helps someone out there.