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 →
7 Older Entries »
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 →
Introduction As I already mentioned, you should never use the TABLE identifier generator since it does not scale properly. In this post, I’ll show you why you should not rely on the AUTO GenerationType strategy if you’re Hibernate application uses MySQL. Prior to Hibernate 5 On Hibernate 4, if you had the following entity mapping: … Continue reading Why should not use the AUTO JPA GenerationType with MySQL and Hibernate →
Introduction As previously explained, the TABLE identifier generator does not scale, so you should avoid id. However, some enterprise applications might need to run on both MySQL (which does not support database sequences), as well as Oracle, PostgreSQL and SQL Server 2012. This is article is going to explain how easily you can achieve this … Continue reading How to replace the TABLE identifier generator with either SEQUENCE or IDENTITY in a portable way →
Introduction I read a very interesting article by Krešimir Nesek regarding MySQL result set streaming when it comes to reducing memory usage. Mark Paluch, from Spring Data, asked if we could turn the MySQL result set streaming by default whenever we are using Query#stream or Query#scroll. That being said, the HHH-11260 issue was created, and … Continue reading How does MySQL result set streaming perform vs fetching the whole JDBC ResultSet at once →
Introduction This article is part of a series of posts related to calling various relational database systems stored procedures and database functions from Hibernate. The reason for writing this down is because there are many peculiarities related to the underlying JDBC driver support and not every JPA or Hibernate feature is supported on every relational … Continue reading How to call MySQL stored procedures and functions with JPA and Hibernate →
Recent Tips and News on Java, Java EE 6, GlassFish & more :
• Using Java Persistence API for Java SE 7
Desktop applications in NetBeans 7 (Oracle Learning
“I believe that one should benchmark before making any technology decisions.” An interview with Pieter van Zyl creator of the OO7J benchmark. In August last year, I published an interesting resource in ODBMS.ORG, the dissertation of Pieter van Zyl, from the University of Pretoria:“Performance investigation into selected object persistence stores”. The dissertation presented the OO7J [...]
7 Older Entries »