Thursday 31 October 2013

[Java] Mapping relational concepts with Hibernate 4

It is crucial to know that O/R mapping using Hibernate isn't about transforming every table you want to use in your application into a Java class. Notice that relational and object-oriented are two different paradigms. It would be more appropriate to re-think the design of the database tables using Java and object-oriented programming. In this tutorial, which is aimed for first-timers, we will tackle basic O/R mapping using Hibernate 4, in other words, we will see how to join tables with their respective object-oriented representations. I assume that you are able to make and run a basic Hibernate example, otherwise please read the first tutorial "Hello Hibernate 4 with Eclipse Kepler" (http://peace-and-code.blogspot.com/2013/10/java-hello-hibernate-4-with-eclipse.html). In this tutorial, we use Hibernate 4.2.5 (http://sourceforge.net/projects/hibernate/files/
hibernate4/4.2.5.Final/
).

Saturday 19 October 2013

[Java] Hibernate 4 object states

In order to manage objects representing rows in database tables, the user of Hibernate needs to have a grasp of object states within the framework. This tutorial will be an introduction for first-timers to the notion of object states in Hibernate. I assume that you are able to make and run a basic Hibernate example, otherwise please read the first tutorial "Hello Hibernate 4 with Eclipse Kepler" (http://peace-and-code.blogspot.com/2013
/10/java-hello-hibernate-4-with-eclipse.html
).
The version of Hibernate we will use is 4.2.5 (http://sourceforge.net/projects/hibernate/files/hibernate4/4.2.
5.Final/
).
In the rest of this tutorial, we will refer to classes mapped to actual database tables as entities, and to the subsequent objects representing rows in these tables as entity instances.

Monday 7 October 2013

[Java] Hello Hibernate 4 with Eclipse Kepler

In this tutorial, I trace my first experience with Hibernate[1]. Needless to say, this article is meant to introduce newbies to working with Hibernate. Our keywords are clarity and simplicity[2]. Therefore, we will proceed step-by-step and avoid the use of complex manipulations, third party plug-ins or any techniques that could lead a first-timer into unfortunate experiences.