Finally I managed to combine all the required technologies. Now a Servlet represents a piece of business-logic which gets data from database through Hibernate session. The problem was with the last part. In the class, that interacts with Hibernate objects, instead of using the current Hibernate session, it was necessary to create a new one (unlike what was written in a tutorial):
this.session = HibernateBookUtil.getSessionFactory().openSession();
because otherwise the class couldn't "see" the current session. Maybe this issue is really basic but for me it was very confusing.
this.session = HibernateBookUtil.getSessionFactory().openSession();
because otherwise the class couldn't "see" the current session. Maybe this issue is really basic but for me it was very confusing.
No comments:
Post a Comment