Hibernate articles

Result transformers

One of very popular pitfalls of database object mappers is the number of executed queries before constructing final entity. In Hibernate with FetchMode enum we can control better the quantity of queries executed against the database. However, in some cases we can need some supplementary help in the form of result transformers.

Continue Reading β†’

Eager and lazy collections loading

Relation database management systems (RDBMS) are based on relational model. Naturally, all mapping systems must be able to represent these relationships on application layer. JPA defines several ways to do that, but all have some common points. One of them is the technique of fetching associated data.

Continue Reading β†’

Transaction isolation in Hibernate

Working with databases implies the respect of ACID principle. One of "tools" used to ensure this respect are transactions.

Continue Reading β†’

Primary key strategies in Hibernate

Almost every time we use auto increment keys (or serial in PostgreSQL). But Hibernate allows three more choices to handle primary key generation of entity objects. This article will show it.

Continue Reading β†’

Hibernate with JPA

In the previous articles we were working with Hibernate's specific elements as Session or SessionFactory. But they are not the only possible choices. We can too opt for working with Hibernate's implementation of JPA specification.

Continue Reading β†’

Batch processing in Hibernate

When multiple operations must be processed at once, it's better to do it automatically. This type of operations is called batch (do not confuse with bash which is a command language).

Continue Reading β†’

Locking in Hibernate JPA

Locking is very useful for the applications based on concurrency. Thanks to it, we can avoid the collision being a results from simultaneous updates to the same data by two or more different users.

Continue Reading β†’

Difference between SessionFactory and EntityManagerFactory

There are two ways to handle persistence in Hibernate: session and entity manager. Through this article, we'll see the differences between this two mechanisms.

Continue Reading β†’