Category: Hibernate

0

How to lock entries in the database to avoid double-processing using Update with limit

Many services have some sort of job that gets executed at regular intervals and does some sort of processing or aggregation. In many instances you read data from the database, do the needed calculations and write the result. This is pretty straightforward and normally does not pose any major problems. You have @Scheduled in Spring, Scheduled Tasks in Play or a simple CRON job that gets executed at regular intervals. Everything works fine if you have one instance that does...

0

Using lazy-loading in JPA to speed up your application

Hibernate makes working with the database a lot easier. You just need to define your entities and the library does the job of retrieving data or persisting your objects. This is true for all modern JPA libraries, like Hibernate or Spring Data. The more complex you have your objects, the more the benefits of using such libraries. However, there is a big downside to this approach and one that can make your application feel slow or sluggish. An example of...

string-uuid-hibernate-mysql 3

How to use String UUID in Hibernate with MySQL

Using a unique ID for columns in a table is important. Besides the auto-increment option, we can use the Java UUID column, however, if we want it to be human-readable we need to store it in a VARCHAR column. This can be easily done using the @Type annotation in Hibernate