Open SourceConfiguring Hibernate for a Java Servlet Application

Configuring Hibernate for a Java Servlet Application

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

From an object-oriented perspective, persistence actually can be considered an extension of an object’s lifecycle — a minor part of the software, as compared with the whole domain. Thus, a programmer who relies on a DBMS should not focus mainly on persistence, because DBMSs are complex entities with their own constraints, rules and protocols that the programmer needs to follow. In order to follow DBMS constraints, rules and protocols, programmers — even object-oriented programmers — are tempted to put their main focus on the database technology and persistence and start performing data processing.

Object relational modeling (ORM) tools such as Hibernate free developers from these concerns by allowing transparent persistence that enables applications to switch to any database. These tools also overcome the paradigm mismatch between object-oriented data and table-oriented relational databases. Hibernate in particular maps Java classes to database tables and provides data query and retrieval facilities that significantly reduce development time. Such functionality makes Hibernate an ideal persistence framework for Java Swing applications, Java Servlet-based applications, or J2EE/Java EE applications using EJB session beans.

In her JavaBoutique.com article, Jeyarani Venkatasamy explains how to configure Hibernate for a Java Servlet-based application to persist the Employee persistent class. More specifically, she explores:

  • Creating a basic hibernate.cfg.xml file
  • Building mapping definition files to provide Hibernate with information about the persistent class (Employee class).
  • The primary Hibernate classes used to persist and retrieve classes


Read the full story at Java Boutique:
Configuring Hibernate for a Java Servlet Application

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories