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 →
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 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
Library) |
“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 [...]
Not so long ago, in a galaxy not very far away... a middle-aged
programmer battled to free memory from the dark side of the
hibernate query cache. He was successful, or so it seemed.
For the query cache memory problems had risen from the ashes --
stronger and more bloated than ever...
What's With All This Garbage?
We hit a case at work (again), where the java server process came
to a grinding halt. It wasn't dead, it just wasn't making
much forward progress either. A quick look at the heap
stats showed we were nearly at capacity and that garbage
collection was eating all CPU time, thus not allowing any real
work to happen. Looks like it is time to whip out the ol'
memory profiler. This time I went with Eclipse's Memory Analysis
Tool . …