Hibernate

Hibernate ORM enables developers to more easily write applications whose data outlives the application process. As an Object/Relational Mapping (ORM) framework, Hibernate is concerned with data persistence as it applies to relational databases (via JDBC).

Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. 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. It generates SQL calls and relieves the developer from manual result set handling and object conversion. Applications using Hibernate are portable to supported SQL databases with little performance overhead.

In addition to its own “native” API, Hibernate is also an implementation of the Java Persistence API (JPA) specification. As such, it can be easily used in any environment supporting JPA including Java SE applications, Java EE application servers, Enterprise OSGi containers, etc.

Hibernate supports lazy initialization, numerous fetching strategies and optimistic locking with automatic versioning and time stamping. Hibernate requires no special database tables or fields and generates much of the SQL at system initialization time instead of at runtime. Hibernate consistently offers superior performance over straight JDBC code, both in terms of developer productivity and runtime performance.

Hibernate was designed to work in an application server cluster and deliver a highly scalable architecture. Hibernate scales well in any environment: Use it to drive your in-house Intranet that serves hundreds of users or for mission-critical applications that serve hundreds of thousands. Hibernate is well known for its excellent stability and quality, proven by the acceptance and use by tens of thousands of Java developers.

Mapping Java classes to database tables is accomplished through the configuration of an XML file or by using Java Annotations.

Read below java tutorials for understanding various concepts involved into hibernate.

Related Tags

Tutorials

[SOLVED] Hibernate – No row with the given identifier exists

1. Reason The ObjectNotFoundException exception is thrown when we try to load an entity in hibernate with session.load() method and entity is not found. The exception trace looks like this: 2. Solution The correct way to solve this problem is to use session.get() method. The get() method will return null …

Hibernate Named Query Examples

Learn to create, group and execute named HQL and named native SQL queries in Hibernate using @NamedQuery and @NamedNativeQuery annotations.

Inserting Objects with Hibernate

Learn to insert an object into the database using hibernate’s Session interface, JPA’s EntityManager and HQL Query interface with examples.

Hibernate / JPA One-to-Many Mappings

Hibernate one to many mapping is made between two entities where the first entity can have a relation with multiple instances of the second entity but the second can be associated with only one instance of the first entity. It is a 1 to N relationship. For example, in any …

Hibernate Hello World Example

Step by step hibernate hello world example with maven and eclipse. Learn to create, configure and store hibernate 5 entities in the database.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.