heartin's blog

Hibernate Framework References

We use various materials like books, internet resources etc. for our learning, for teaching and even for preparing notes. We will list those materials here for your reference. We might include only the very basic information required for our learning and training purposes here. You may refer to these additional materials for further reading and learning.



  • Hibernate Recipes: A Problem-Solution Approach by by Joseph Ottinger, Gary Mak and Srinivas Guruzu.

Configuring a Hibernate 4.3 Application with JPA Entity Managers

In JPA, the EntityManager controls the lifecycle of the entities.

Different ORM vendors provide its own entity manager, which is usually a wrapper around the core API and thus supports the JPA programming interfaces, life cycles and query language.

You obtain the EntityManager from an entity manager factory. EntityManagerFactory has the same role as SessionFactory in Hibernate.

What is a framework?

A software framework is a reusable software platform that makes the life of developers easy by providing something commonly needed out of the box; developers can then use it or extend it.

For instance, Struts basically provides a MVC framework by providing a controller out of the box and an xml mechanism to configure MVC using xml files without hardcoding them in the code. 

Hibernate Questions on Important Differences for Self Assessment

These are some of the commonly asked questions to check if you know the differences between important concepts or APIs in Hibernate. This may contain beginner to advanced level questions.


  1. Differentiate between entities and value types in Hibernate.

  2. What is the difference between save() and persist() methods in Hibernate?

  3. What is the difference between get and load methods in hibernate?

Different Ways to Configure in Hibernate 4.3

Before working with hibernate in your code, you will need to configure Hibernate with information regarding your database such as host, port, credentials etc. You also need to create mappings that tell hibernate how to map the state of a Java entity to the columns of its corresponding table.

We can configure various hibernate features either through annotations or through xml files (hbm files). Preferred approach currently is annotations.


You can configure Hibernate mainly in three ways:

Hibernate Essentials Questions for Self Assessment

This is a list of basic questions from Hibernate which you can use to check your understanding or even prepare for interviews. You may use the parent chapter, other chapters or hibernate or the forum to discuss more on these questions.


  1. What is a framework?

  2. What do you mean by CRUD?

  3. What is Hibernate? What are the advantages of using Hibernate?

  4. What is Java Persistence API (JPA)?

LinkedHashMap Class

LinkedHashMap extends HashMap and has a predictable iteration order.


Properties of LinkedHashMap

  1. LinkedHashMap implementation maintains a doubly-linked list running through all of its entries.

  2. The doubly linked list maintained by the LinkedHashMap implementation defines the iteration ordering.

  3. By default, the order is the order in which keys were inserted into the map.

[Assignment Problem] Multi-threaded Series Printer


Write a multi-threaded program to print data from four series of data in alternating order.

There are four series of data are as below:

Series 1:              0,            4,            8,            12,          …

Series2:               1,            5,            9,            13,          …

Series3:               2,            6,            10,          14,          …

[Lab-Analysis] Setting Up For Rest Web Services Development Using Maven Jersey Archetype

In the lab @ http://javajee.com/setting-up-the-environment-for-developing-rest-web-services-with-jersey-using-maven, you setup the environment and executed a REST service.

Below are the important files generated, as you can see from the eclipse Project Explorer:

[Lab] Setting Up For Rest Web Services Development Using Maven Jersey Archetype

Jersey is a popular JAX-RS implementation.

Jersey is the open source, production quality, JAX-RS (JSR 311) Reference Implementation for building RESTful Web services.

In addition to being the Reference Implementation, Jersey also provides an API so that developers may extend Jersey to suit their needs.

You can download JAX-RS from Jersy Homepage at jersey.java.net. You can also set it up using a build tool such a maven.



Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!