Friday 29 November 2013

[Java] Hibernate basics with Eclipse

This entry proxies for a series of tutorials which introduces the basics of Hibernate for utter beginners. I only assume that the reader have a grasp of the Java and SQL semantics. Obviously, there is more to Hibernate than we have covered in these tutorials. A good sequel for these tutorials would cover the use of annotations to describe entity classes and their attributes. Other related entries would include lazy initialization, caching and some other mechanics regarding the use of Session objects, as well as the integration of Hibernate in enterprise applications.
It is worth mentioning that these tutorials are basically my notes when I was learning Hibernate.

Wednesday 13 November 2013

[Java] Hibernate query basics

Once links are established between the database and persistent entities, it is perfectly normal to save, modify and query the collections of data.
This is a tutorial for first-timers in which basic query mechanics in Hibernate will be discussed.
For further examples using Hibernate, check the following tutorials:

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.