Introduction In this article, we are going to see how we can sort an SQL query result set using an ORDER BY clause that takes a RANDOM function provided by a database-specific function. This is a very handy trick, especially when you want to shuffle a given result set. Note that sorting a large result set using a RANDOM function might turn out to be very slow, so make sure you do that on small result sets. If you have to shuffle a large result set and limit it afterward, then it’s… Read More
Introduction In this article, we are going to see how we can override the default FlushMode used by Hibernate. If you bootstrap Hibernate natively, and not as a JPA provider, the default Hibernate FlushMode.AUTO strategy will be used, which, as explained in this article, does not trigger a Persistence Context flush prior to executing a native SQL query.
Introduction In this article, we are going to see what is the best way to set up the query timeout interval with JPA and Hibernate. Setting the query timeout allows you to cancel slow-running queries that would, otherwise, put pressure on database resources.
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.