Home » Tag Archives: JBoss Hibernate (page 2)

Tag Archives: JBoss Hibernate

SELECT statements batch fetching with JDBC and Hibernate

jboss-hibernate-logo

Introduction Now that I covered Hibernate batch support for INSERT, UPDATE and DELETE statements, it’s time to analyze SELECT statements result set batch fetching. JDBC ResultSet fetching The JDBC ResultSet offers a client-side Proxy cursor for fetching the current statement return data. When the statement gets executed, the result must be transferred from the database cursor to the client-side one. ...

Read More »

Hibernate Tutorial – The ULTIMATE Guide (PDF Download)

jboss-hibernate-logo

EDITORIAL NOTE: Hibernate ORM (Hibernate in short) is an object-relational mapping framework, facilitating the conversion of an object-oriented domain model to a traditional relational database. Hibernate solves the object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. Hibernate is one of the most popular Java frameworks out there. For this reason we have provided ...

Read More »

How to batch DELETE statements with Hibernate

jboss-hibernate-logo

Introduction In my previous post, I explained the Hibernate configurations required for batching INSERT and UPDATE statements. This post will continue this topic with DELETE statements batching. Domain model entities We’ll start with the following entity model:       The Post entity has a one-to-many association to a Comment and a one-to-one relationship with the PostDetails entity: @OneToMany(cascade = ...

Read More »

jOOQ vs. Hibernate: When to Choose Which

jboss-hibernate-logo

Hibernate has become a de-facto standard in the Java ecosystem, and after the fact, also an actual JavaEE standard implementation if standards matter to you, and if you put the JCP on the same level with ISO, ANSI, IEEE, etc. This article does not intended to discuss standards, but visions. Hibernate shares JPA’s vision of ORM. jOOQ shares SQL’s vision ...

Read More »

How to batch INSERT and UPDATE statements with Hibernate

jboss-hibernate-logo

Introduction JDBC has long been offering support for DML statement batching. By default, all statements are sent one after the other, each one in a separate network round-trip. Batching allows us to send multiple statements in one-shot, saving unnecessary socket stream flushing. Hibernate hides the database statements behind a transactional write-behind abstraction layer. An intermediate layer allows us to hide ...

Read More »

Hibernate CascadeType.LOCK gotchas

jboss-hibernate-logo

Introduction Having introduced Hibernate explicit locking support, as well as Cascade Types, it’s time to analyze the CascadeType.LOCK behavior. A Hibernate lock request triggers an internal LockEvent. The associated DefaultLockEventListener may cascade the lock request to the locking entity children. Since CascadeType.ALL includes CascadeType.LOCK too, it’s worth understanding when a lock request propagates from a Parent to a Child entity. ...

Read More »

A beginner’s guide to JPA and Hibernate Cascade Types

jboss-hibernate-logo

Introduction JPA translates entity state transitions to database DML statements. Because it’s common to operate on entity graphs, JPA allows us to propagate entity state changes from Parents to Child entities. This behavior is configured through the CascadeType mappings. JPA vs Hibernate Cascade Types Hibernate supports all JPA Cascade Types and some additional legacy cascading styles. The following table draws ...

Read More »

Hibernate Locking Patterns – How does PESSIMISTIC_READ and PESSIMISTIC_WRITE work

jboss-hibernate-logo

Introduction Java Persistence API comes with a thorough concurrency control mechanism, supporting both implicit and explicit locking. The implicit locking mechanism is straightforward and it relies on: Optimistic locking: Entity state changes can trigger a version incrementation Row-level locking: Based on the current running transaction isolation level, the INSERT/UPDATE/DELETE statements may acquire exclusive row locks While implicit locking is suitable ...

Read More »

JPA 2.1 criteria delete/update and temporary tables in Hibernate

jboss-hibernate-logo

Since JPA version 2.0 the EntityManager offers the method getCriteriaBuilder() to dynamically build select queries without the need of string concatenation using the Java Persistence Query Languge (JPQL). With version 2.1 this CriteriaBuilder offers the two new methods createCriteriaDelete() and createCriteriaUpdate() that let us formulate delete and update queries using the criteria API. For illustration purposes lets use a simple ...

Read More »

Hibernate locking patterns – How does PESSIMISTIC_FORCE_INCREMENT Lock Mode work

jboss-hibernate-logo

Introduction In my previous post, I introduced the OPTIMISTIC_FORCE_INCREMENT Lock Mode and we applied it for propagating a child entity version change to a locked parent entity. In this post, I am going to reveal the PESSIMISTIC_FORCE_INCREMENT Lock Mode and compare it with its optimistic counterpart. More alike than different As we already found out, the OPTIMISTIC_FORCE_INCREMENT Lock Mode can ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close