Home » Tag Archives: JBoss Hibernate

Tag Archives: JBoss Hibernate

One to many XML mapping in Hibernate

jboss-hibernate-logo

One to many relationship states that a single instance of an entity is associated with multiple instances of the another entity. In other words, each record in one of the tables is associated with multiple records in the other table. Let us check out how we can define such relationship in Hibernate through XML mapping file. 1. Entity Relationship Diagram Assuming ...

Read More »

Rapid Development with Hibernate in CQRS Read Models

jboss-hibernate-logo

In this post I’m going to share a few tricks for using Hibernate tooling in CQRS read models for rapid development. Why Hibernate? Hibernate is extremely popular. It’s also deceptively easy on the outside and fairly complex on the inside. It makes it very easy get started without in-depth understanding, misuse, and discover problems when it’s already too late. For ...

Read More »

Integrating JPA Hibernate with OptaPlanner

optaplanner-logo

We’ve been improving the integration of OptaPlanner with the rest of JEE, so it’s easier to build end user applications that just work. Let’s take a look at the improved JPA Hibernate integration. The basics Both JPA Hibernate and OptaPlanner work on POJO’s (Plain Old Java Objects), so just add some JPA annotations on your domain objects to persist them ...

Read More »

Use stored procedures with Hibernate

jboss-hibernate-logo

This article show different ways to call stored procedures from hibernate. JDBC actions will not be covered. Postgresql will be used as a database. CREATE DATABASE example; CREATE TABLE company ( company_id BIGSERIAL PRIMARY KEY, name TEXT NOT NULL ); CREATE TABLE benefit ( benefit_id BIGSERIAL PRIMARY KEY, name TEXT, company_id BIGINT, CONSTRAINT fk_company FOREIGN KEY (company_id) REFERENCES company (company_id) ...

Read More »

Hibernate: use join table alias on sqlRestriction

jboss-hibernate-logo

When using hibernate in case of complex queries there is the need to use sql. Therefore sqlRestrictions come to the rescue. However using sql restrictions on join table alias is a bit tricky. There would be three tables: The company table. The employee table. Each employee belongs to one company therefore we have a many to one relationship. The benefit ...

Read More »

7 ways to improve performance of a Hibernate application

jboss-hibernate-logo

Hibernate is a great tool for integrating Java web applications with a SQL database, but what should we do when the application’s response times start increasing considerably? What should we do when we’re getting doubts whether the application will scale with the growth of our customer base? Before spending a fortune on hosting or rewriting the code, consider analysing and improving these 7 areas of your web application. #1 Tuning JVM memory settings The JVM ...

Read More »

Using Hibernate Bean Validator in Java SE

jboss-hibernate-logo

The main Bean Validation page states that “Bean Validation is a Java specification which … runs in Java SE but is integrated in Java EE (6 and 7).” This post demonstrates using Java Bean Validation reference implementation (Hibernate Validator) outside of a Java EE container. The examples in this post are based on Hibernate Validator 5.1.3 Final, which can be ...

Read More »

How does Hibernate Query Cache work

jboss-hibernate-logo

Introduction Now that I covered both Entity and Collection caching, it’s time to investigate how Query Caching works. The Query Cache is strictly related to Entities and it draws an association between a search criteria and the Entities fulfilling that specific query filter. Like other Hibernate features, the Query Cache is not as trivial as one might think. Entity model ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Advanced Java Guide
  • Java Design Patterns
  • JMeter Tutorial
  • Java 8 Features Tutorial
  • JUnit Tutorial
  • JSF Programming Cookbook
  • Java Concurrency Essentials