Hibernate Tutorials, Tips & Tricks

Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions.

Hibernate is free software that is distributed under the GNU Lesser General Public License.

Hibernate’s primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. Hibernate generates the SQL calls and attempts to relieve the developer from manual result set handling and object conversion and keep the application portable to all supported SQL databases with little performance overhead.

org.hibernate.AnnotationException: No identifier specified for entity

When you are writing a piece of code from scratch a lot of time you do silly mistakes and still wonder why its not working. Well same thing happened the other day when I added a Hibernate Entity class in one project and was struggling to make it work.The exception was:org.hibernate.AnnotationException: No identifier specified for entity: net.viralpatel.hibernate.Employee at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:650) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1112) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:416) at ...

Hibernate Inheritance: Table Per Concrete Class (Annotation & XML mapping)

Hibernate Inheritance: Table Per Concrete Class (Annotation & XML mapping)
Welcome to Hibernate Tutorial Series. In previous tutorials we saw how to implement Inheritance in Hibernate: One Table per Subclass.Today we will see how to implement Hibernate Inheritance: One Table per Concrete Class scheme.You may want to look at previous tutorials. Here is the complete list for you.Introduction to Inheritance in Hibernate Java is an object oriented language. It is possible to implement Inheritance in Java. ...

Hibernate Inheritance: Table Per Subclass (Annotation & XML mapping)

Hibernate Inheritance: Table Per Subclass (Annotation & XML mapping)
Welcome to Hibernate Tutorial Series. In previous tutorials we saw how to implement Inheritance in Hibernate: One Table Per Hierarchy.Today we will see how to implement Hibernate Inheritance: One Table per Subclass scheme.You may want to look at previous tutorials. Here is the complete list for you.Introduction to Inheritance in Hibernate Java is an object oriented language. It is possible to implement Inheritance in Java. Inheritance ...

Hibernate Inheritance: Table Per Class Hierarchy (Annotation & XML Mapping)

Hibernate Inheritance: Table Per Class Hierarchy (Annotation & XML Mapping)
Welcome to Hibernate Tutorial Series. In previous tutorials we saw how to implement Relationship Mapping in Hibernate. We saw different mapping techniques like One to Many, Many to Many using both Annotations and XML mapping.Today we will see how the Inheritance is managed in Hibernate.You may want to look at previous tutorials. Here is the complete list for you.Introduction to Inheritance in Hibernate Java ...

Hibernate Self Join Many To Many Annotations mapping example

Hibernate Self Join Many To Many Annotations mapping example
Welcome to the Hibernate Tutorial Series. In previous tutorial we saw how to implement Self Reference One to Many relationship using Annotation mapping. In this tutorial we will modify the source code from previous tutorial and implement Self-Join Many to Many mapping using Annotation..Self Join: Many to Many In a query, a table that is related to itself by a connecting / bridge table. For ...

Hibernate Self Join Annotations One To Many mapping example

Hibernate Self Join Annotations One To Many mapping example
Welcome to the Hibernate Tutorial Series. In previous tutorial we saw how to implement Many to Many relationship using Annotation mapping. In this tutorial we will modify the source code from previous Many To Many XML mapping tutorial and add JPA/Annotation support to it.Self Join: One to Many In a query, a table that is related to itself by two different fields. For example, an ...

Hibernate Many To Many Annotation Mapping Tutorial

Hibernate Many To Many Annotation Mapping Tutorial
Welcome to the Hibernate Tutorial Series. In previous tutorial we saw how to implement Many to Many relationship using XML mapping. In this tutorial we will modify the source code from previous Many To Many XML mapping tutorial and add JPA/Annotation support to it.Let us see how to implement Many-to-Many relationship in Hibernate using Annotation.1. Create DatabaseFor this example, we will MySQL database. We ...

Hibernate Many To Many XML Mapping Tutorial

Hibernate Many To Many XML Mapping Tutorial
Welcome to the Hibernate Tutorial Series. In previous tutorial we saw how to implement One to Many Annotation mapping as well as XML mapping. In this tutorial we will understand How to implement Bi-directional Many-to-Many relationship in Hibernate using XML mappings.First let us see the formal definition of Many-to-Many relationship:Many-To-Many Relationship: A logical data relationship in which the value of one data element ...

Hibernate One To Many Annotation tutorial

Hibernate One To Many Annotation tutorial
Welcome to the Hibernate Tutorial Series. In previous tutorial we saw how to implement One to Many relationship using XML mapping. In this tutorial we will modify the source code from previous One To Many XML mapping tutorial and add JPA/Annotation support to it.1. Database SetupFor this example, we will use MySQL database. Create following two tables in MySQL. Note that Employee and Department ...

Hibernate One To Many XML Mapping Tutorial

Hibernate One To Many XML Mapping Tutorial
Welcome to the Hibernate Tutorial Series. In previous tutorial we saw how to implement One-to-one Annotation mapping as well as XML mapping. In this tutorial we will understand How to implement Bi-directional One-to-Many relationship in Hibernate using XML mappings.First let us see the formal definition of One-to-Many relationship:One-To-Many Relationship: A relationship in which each record in one table is linked to multiple records ...
Page 1 of 212