j2ee Archive

Introduction to HibernateUtil and the SessionFactory Interface

HibernateUtil is a convenience class for obtaining the Hibernate SessionFactory instance, which are used for building hibernate sessions. Hibernate sessions themselves are not thread safe i.e. there exists only one per thread of execution (used once and then discarded). A typical HibernateUtil class looks like: [crayon-5a8c1d048cdd8972651797/] Some important points worth noting regarding the SessionFactory:...

What is dependency injection?

We, as a java programmers rely on low coupling of the java components/classes. This aims at increasing the re-usability of the components and also help in independent testing of the component. To supplement to this feature, Spring came into picture and through its dependency injection capability, it helped the dependencies of a class...

My First Servlet

I hope you would be familiar to the HTTP GET and POST methods. These are actually the two methods by which the browser sends the information to the web server. The GET method appends the information to the page request, whereas POST method sends the information as a separate message. The...

Hibernate configuration and mapping file

There are several ways to configure Hibernate. Having the HibernateUtil convenience class ready as we had learnt earlier in the previous post, we can go ahead using it to configure the Hibernate application with the Oracle Database. Note the following line in the HibernateUtil class, [crayon-5a8c1d048e7f0046683301/] This would search for the Hibernate...

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.