Introduction While developing a Spring Boot application is rather easy, tuning the performance of a Spring Boot application is a more challenging task, as, not only it requires you to understand how the Spring framework works behind the scenes, but you have to know what is the best way to use the underlying data access framework, like Hibernate for instance. In a previous article, I showed you how easily to optimize the performance of the Petclinic demo application. However, by default, the Petclinic Spring Boot application uses the in-memory HSQLDB database, which... Read More
10 Older Entries »
Introduction In this article, we are going to test the MySQL 8 implementation of custom SQL CHECK constraints. Although the CHECK clause is a standard SQL feature, prior to MySQL 8.0.16, the clause was parsed and ignored, so this functionality could only be emulated via BEFORE INSERT and UPDATE triggers. Custom SQL CHECK constraints As I explained in this article, custom SQL CHECK constraints are very useful to ensure non-nullability constraints for JPA entity subclass-specific attributes when using the SINGLE TABLE JPA inheritance strategy. To understand the problem, consider we have the... Read More
Introduction As I explained in this article, multitenancy is an architectural pattern which allows you to isolate customers even if they are using the same hardware or software components. There are multiple ways you can achieve multitenancy, and in this article, we are going to see how you can implement a multitenancy architecture using the … Continue reading Hibernate database catalog multitenancy →
The post 5 Reasons and 101 Bugfixes – Why You Should Use Hibernate 5.3 appeared first on Thoughts on Java.
Hibernate 5.3 is available for a little more than 3 months now, and last week, the team released the 3rd maintenance release. So, it’s about time to take a closer look at the new version.
In addition to more than 100 bug fixes, Hibernate 5.3 includes a few features and improvements that might motivate you to update your current project.
Improved Memory consumption
Let’s start with probably the best reason to update to Hibernate 5.3: It consumes less memory than the previous versions.
The improvement was triggered by an …[Read more]
Introduction When executing an entity query (e.g. JPQL, HQL or Criteria API), you can use any SQL function without having to register it as long as the function is passed directly to the WHERE clause of the underlying SQL statement. However, if the SQL function is used in the SELECT clause, and Hibernate has not … Continue reading The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate →
The post The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate appeared first on Vlad Mihalcea.
Introduction Traditionally, both MySQL and MariaDB relied on AUTO_INCREMENT columns to generate an IDENTITY Primary Key. Although IDENTITY columns are very efficient in generating the Primary Key value, when it comes to using JPA and Hibernate, the IDENTITY generator prevents us from using JDBC batch inserts. To automatically enroll multiple INSERT, UPDATE or DELETE statements, … Continue reading MariaDB 10.3 supports database sequences →
Introduction Last week, one of my blog readers asked me of a way to reuse the @Id mapping so that it won’t have to be declared on each an every entity. Because this is a good opportunity to introduce @MappedSuperclass, I decided to answer the question with a blog post. Domain Model Assuming we are … Continue reading How to inherit properties from a base class entity using @MappedSuperclass with JPA and Hibernate →
Introduction Although there is an SQL Standard, every relational database is ultimately unique, and you need to adjust your data access layer so that you get the most out of the relational database in use. In this article, we are going to see what you can do to boost up performance when using MySQL with … Continue reading 9 High-Performance Tips when using MySQL with JPA and Hibernate →
One of the benefits of using JPA and Hibernate is that it provides an abstraction of database-specific dialects and features. So, in theory, you can implement an application, connect it to one of the supported databases and it will run without any code changes.
Hibernate does that really well. But let’s be honest, you didn’t expect that your application will run perfectly with every supported database, did you?
Hibernate handles the most important things. But if you want your application to perform well, you still need to know which database(s) you want to use and adjust your configuration and code accordingly.
In one of the previous posts, I talked about 6 things you need to know if you want to use
Hibernate with a PostgreSQL database. And today I want to
have a closer look at the MySQL database.
Introduction Dealing with time zones is always challenging. As a rule of thumb, it’s much easier if all date/time values are stored in the UTC format, and, if necessary, dealing with time zone conversations in the UI only. This article is going to demonstrate how you can accomplish this task with JDBC and the awesome … Continue reading How to store date, time, and timestamps in UTC time zone with JDBC and Hibernate →
10 Older Entries »