Is Hibernate the best choice?
Is Hibernate the best choice? Or is the technical marketing of other ORM vendors lacking? Although, I tend to use Hibernate as my first choice, it would be nice to see some head to head comparisons of Hibernate vs. TopLink (pros and cons), Hibernate vs. OpenJPA, Hibernate vs. Cayenne, etc. Searching around finds that many of the comparison are pretty old and not very detailed or compelling.
Getting Started With Hibernate
This Hibernate tutorial is part of the “Hibernate Introduction” series. This will help to setup a simple Java project that uses Hibernate ORM and a database to demonstrate insertion of a record. Consider it as a “Hello World” program for Hibernate.
The minimal configuration for testing Hibernate
In my previous post I announced my intention of creating a personal Hibernate course. The first thing to start with is a minimal testing configuration. The examples are relevant for Hibernate 4. In a real production environment you won’t use Hibernate alone, as you may integrate it in a JEE or Spring container. For testing Hibernate features you don’t need a full-blown framework stack, you can simply rely on Hibernate flexible configuration options.
Struts2 & Hibernate 4 integration
Before proceeding to this tutorial, you can go through my earlier tutorial how to start new struts2 application. In this tutorial we are going to see how to integrate hibernate with struts 2. Let us develop sample application for Adding / Deleting / Listing Items in Inventory using MySQL database with Hibernate support. Later on we can see how to migrate the same application to use DB2 database without changing any java code and query part. Switching to other SQL database requires few changes in Hibernate configuration file which is the main advantage of using Hibernate. Without using hibernate it is very difficult to switch over to any database especially at later stage.
In this Hibernate tutorial page, we will see about the advantage of using the Hibernate as the Object Relational Mapping (ORM) layer in a Java application. We will start with the advantages of ORM and then move to the Hibernate advantages.
Hibernate: Managed Versus Non-Managed Environments
This Hibernate tutorial is to understand the difference between having a managed vs non-management environments. Configuring Hibernate requires us to determine the type of environment that Hibernate is going to function.
This Hibernate tutorial is to go through the Hibernate architecture to know about the components involved. It is important to understand the Hibernate architecture and know the main components. It will certainly help when we deal with different type of Java applications.
How to customize hibernate dirty checking mechanism
In my previous article I described the Hibernate automatic dirty checking mechanism. While you should always prefer it, there might be times when you want to add your own custom dirtiness detection strategy. Hibernate offers the following customization mechanisms: Hibernate Interceptor#findDirty(), CustomEntityDirtinessStrategy
Hibernate one-to-one mapping using annotations
If you are working on any hibernate project or you are planning to work on any in future, then you can easily understand the one-to-one relationships between several entities in your application. In this post, i will discuss variations of one-to-one mappings supported in hibernate.
Hibernate 3 introduction and writing hello world application
Hibernate was started in 2001 by Gavin King as an alternative to using EJB2-style entity beans. Its mission back then was to simply offer better persistence capabilities than offered by EJB2 by simplifying the complexities and allowing for missing features. Hibernate used its mapping files and configuration files to achieve its objectives. With the introduction of annotations in java community with JDK 1.5, Hibernate community started working on Hibernate 3, which has support for annotations.
Hibernate Example using Hibernate Tools
Learn how to create a simple example using the Eclipse IDE and Hibernate Tools plug-in.
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.
Developing Applications with JBoss and Hibernate
Developers will be introduced to Hibernate and learn to build Java classes and map files from scratch. They will also learn to reverse engineer the database schema into Java classes and Hibernate mapping files and build a web application that will be able to interact with the Hibernate POJOs which they will later deploy to JBoss AS.
Hibernate insert query tutorial
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. This means you are not required to build and execute SQL queries for interaction with database. You just have to instruct hibernate for that by calling hibernate APIs and hibernate will create and execute those SQL queries on behalf of you. In this tutorial, I am giving example of inserting data in a single table. We have an object in application i.e. Employee. We want to store it in database. It has following attributes...
Careful With Native SQL in Hibernate
I really like Hibernate, but I also don’t know a tool that would be nearly as powerful and deceptive at the same time. I could write a book on surprises in production and cargo cult programming related to Hibernate alone. It’s more of an issue with the users than with the tool, but let’s not get too ranty. So, here’s a recent example.
Hibernate collections optimistic locking
Hibernate provides an optimistic locking mechanism to prevent lost updates even for long-conversations. In conjunction with an entity storage, spanning over multiple user requests (extended persistence context or detached entities) Hibernate can guarantee application-level repeatable-reads.
Hibernate facts: how to “assert” the sql statement count
Hibernate simplifies CRUD operations, especially when dealing with entity graphs. But any abstraction has its price and Hibernate is no different. I’ve already talked about the importance of fetching strategy and knowing your Criteria SQL queries, but there is more you can do to rule over JPA. This post is about controlling the SQL statement count that Hibernate calls on your behalf. Before ORM tools got so popular, all database interactions were done through explicit SQL statements, and optimizations were mostly targeted towards slow queries.
Batch insert in Hibernate
This example program shows how to insert multiple rows using the batch processing in hibernate. when there are thousand of rows to be persisted, everytime iterating and inserting will cause the memory problem. Hibernate stores all the persisted objects in the memory. To avoid this problem use batch processing in the hibernate.
Hibernate 4 example to get entity reference for lazy loading
By Wikipedia definition, Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. We know that in hibernate lazy loading can be done by specifying “fetch= FetchType.LAZY” in hibernate mapping annotations.
Hibernate is the most popular Object Relational Mapping (ORM) library available for Java. Hibernate is used to map and manage the application domain object model in sync with the underlying relation model. It is provided by JBoss and it is one of the oldest ORM implementation available for Java.