How to implement an AttributeConverter to support custom types
| |

How to implement an AttributeConverter to support custom types

All JPA implementations, including Hibernate, provide default mappings for a huge set of standard Java classes. You could model the attributes of all your entity classes using those mappings, and you would be able to map all columns of your table model. But this is often not the best fit for your business logic. A…

Native Queries – How to call native SQL queries with JPA & Hibernate
| | |

Native Queries – How to call native SQL queries with JPA & Hibernate

The Java Persistence Query Language (JPQL) is the most common way to query data from a database with JPA. It enables you to reuse your mapping definitions and is easier to use than SQL. But it supports only a small subset of the SQL standard, and it also provides no support for database-specific features. So…

Hibernate with PostgreSQL – 6 things you need to know
| |

Hibernate with PostgreSQL – 6 things you need to know

PostgreSQL is one of the most popular relational databases, and Hibernate is probably the most popular JPA implementation. So, it’s no surprise that they’re often used together and that you don’t have to expect any major issues doing that. But as so often, there is a difference between “it works” and “it works great”. Out…

8 Ways to use the features of your database with Hibernate
| |

8 Ways to use the features of your database with Hibernate

A common misconception when working with Hibernate is that you can only map database tables and don’t use any other database features. That’s not the case, as I want to show you in this post. You can also use lots of other features which allow you to: Map read-only database views Call database functions Execute…