Hibernate Tutorial with Examples
Hibernate ORM (Hibernate in short) is an object-relational mapping tool for the Java programming language.
It provides a framework for mapping an object-oriented domain model to a relational database. Hibernate handles object-relational
impedance mismatch problems by replacing direct, persistent database accesses with high-level object handling functions.
Hibernate's primary feature is mapping from Java classes to database tables, and mapping from Java data types to
SQL data types. Hibernate also provides data query and retrieval facilities. It generates SQL calls and relieves the developer
from the manual handling and object conversion of the result set.
Hibernate Features
- Hibernate is an Open Source persistence technology.
- Its primary feature is applying from Java sessions to data source platforms.
- Hibernate provides Object/Relational mappings. It is different O/R mapping strategies as multiple-objects to single-row mapping,
Polymorphic associations, bi-directional association, association filtering.
- Hibernate provides an SQL inspired language called Hibernate Query Language (HQL) that allows SQL-like queries to be written against Hibernate's data objects.
- Hibernate provides transparent persistence for Plain Old Java Objects (POJOs). The only strict requirement for a persistent class is a no-argument constructor, not necessarily public.
- Hibernate can be used both in standalone Java applications and in Java EE applications using servlets, EJB session beans, and JBI service components.
- In Hibernate jargon, an entity is a stand-alone object in Hibernate's persistent mechanism which can be manipulated independently of other objects. In contrast, a component is subordinate to an entity and can be manipulated only with respect to that entity.
We are giving hibernate examples for each and every topic.
Hibernate Examples
- Hibernate hello world (initial setup) example.
- What is hibernate.cfg.xml configuration?
- What are the basic hibernate persistent annotations?
- What is SessionFactory in Hibernate?
- What is Session object in Hibernate?
- List Hibernate Session interface methods.
- What is Hibernate Query object?
- Basic Hibernate CRUD operations example.
- Hibernate Bidirectional One-to-One mapping using @OneToOne annotation.
- Hibernate Unidirectional One-to-One mapping using @OneToOne annotation.
- Hibernate Eager vs Lazy Fetch Type
- Hibernate Unidirectional One-to-Many mapping using @OneToMany annotation.
- Hibernate Bidirectional One-to-Many mapping using @OneToMany annotation.
- Hibernate Many-to-Many mapping example using @ManyToMany annotation.
- How to enable logging (log4j) in Hibernate?
|