A quick guide to convert between LocalDate and java.sql.Date objects in java 8 with examples. 1. Overview In this tutorial, We’ll learn how to convert java.time.LocalDate to java.sql Date in java 8 and vice versa. This is simple to do but when working jpa framework it is bit different to deal with the table column type. First look at the ...
Read More »Home »
Use the Power of your Database: XML and JSON
Today databases have a lot of functionality that is often not used by software developers because they simply not know that this exists. But knowing about this features can save a lot of time because you may write less code. One of this hidden gems is the ability of producing XML or JSON data using a SQL SELECT statement. In ...
Read More »Run a docker PostgreSQL instance locally for Testing
Running a PostgreSQL instance ad-hoc for testing is not always as bootstraping as it should be. This blog will run a PostgreSQL instance that connects to your workstation’s network and instead of using one of the popular tools like dbeaver we shall use the client that comes with the instance. Also we shall run a bootstrap script to have some ...
Read More »SQL GROUP BY and HAVING Example – Write SQL Query to find Duplicate Emails – LeetCode Solution
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Email | +----+---------+ | 1 | a@b.com | | 2 | c@d.com | | 3 | a@b.com | +----+---------+ For example, your query should return the following for the above table: +---------+ | Email | +---------+ | a@b.com | +---------+ Note: All ...
Read More »[MEGA DEAL] The Ultimate SQL Bootcamp Certification Bundle (98%)
Manage Tasks & Databases Like a Pro with 6 Courses on SQL Lite, Microsoft SQL, MySQL, PostgreSQL, Rest API, and Oracle SQL Hey fellow geeks, This week, on our JCG Deals store, we have another extreme offer.We are offering a massive 98% off on The Ultimate SQL Bootcamp Certification Bundle. Get it now with only $21, instead of the original ...
Read More »SQL as a Service
I’ve been thinking about this since 2007, somewhere around the time S3 was launched by Amazon. I even tried to implement it a few times, but failed right after the design phase. I’ve heard about a startup, which tried to do it too, but also failed. I’m still not sure whether it’s possible to do, but it could definitely become ...
Read More »Read replicas and Spring Data Part 4: Configuring the read repository
Previously we set up two EntityManagers in the same application. One for the reads and one for the writes. Now it’s time to create our read repository. The read only repository will use the secondary read only EntityManager. In order to make it a read only repository, it is essential not to have any save and persist actions. 01 02 ...
Read More »Read replicas and Spring Data Part 3: Configuring two entity managers
Our previous setup works as expected. What we shall do now is to get one step further and configure two separate entity managers without affecting the functionality we achieved previously. The first step would be to set the default entity manager configuration to a primary one.This is the first step 01 02 03 04 05 06 07 08 09 10 ...
Read More »Read replicas and Spring Data Part 2: Configuring the base project
In our previous post we set up multiple PostgreSQL instances with the same data.Our next step would be to configure our spring project by using the both servers. As stated previously we shall use some of the code taken from the Spring Boot JPA post, since we use exactly the same database. This shall be our gradle build file 01 ...
Read More »