JPA Criteria With Pagination

In Java Persistence API (JPA) development, the flexibility and dynamism of queries play a pivotal role, especially when dealing with dynamic search interfaces or scenarios where the query structure is known only at runtime. The JPA Criteria Query emerges as a powerful tool for constructing such dynamic queries, allowing developers to define complex search criteria programmatically.

One critical aspect of real-world applications, particularly those involving user interfaces for specific record searches, is the implementation of pagination. Pagination not only enhances the user experience by presenting results in manageable chunks but also contributes to resource optimization on the application side.

Clustered Quartz Scheduler With Spring Boot and MongoDB

Spring Boot library for Quartz does not work correctly if you start up two instances of service in parallel. Each one of the services starts the execution of the same jobs while the expected behavior is one of the instances is elected to execute the jobs and the other ones waiting in the background, and in the case of failure of the first service, another one is elected.

Springs’ @Scheduled annotation is a very convenient and easy way of scheduling tasks for several reasons. But, if you have a clustered environment and you must run any job just from one node, that does not hold true. You realize that all scheduled jobs will start executing almost at the same time. This may cause problems ranging from unnecessary calls to data inconsistency.  

How to Repair Grub

Last time, installing Windows stopped my Ubuntu from booting-up. After some research, I managed to fix the boot-loader. I thought it might be worth sharing my experience for those who may face the same problem.

First of all, you need a live cd or bootable USB stick of any flavor of Linux distribution. For example, Ubuntu, Mint, or Fedora can be used.

OpenAPI (Swagger) and Spring Boot Integration

Recently. while working on a requirement, there came a need to upload a file for further processing. Mostly in REST APIs, we are accustomed to using JSON input and output while it is XML for SOAP web services. 

This leads us to research how to satisfy the requirement. In Spring, and mainly in Spring Boot, the auto-configuration feature gives us big-time help even though sometimes we have to disable some features to add custom once or to change the order they are sorted in.

Jackson Property Custom Naming Strategy

To serialize or deserialize to/from POJO, Jackson uses a bean naming convention. To accomplish this, it uses annotations. This annotations cover:

  • Property Naming
  • Property Inclusion
  • Property documentation, metadata
  • Deserialization and Serialization details
  • Deserialization details
  • Serialization details
  • Type handling
  • Object references, identity
  • Meta-annotations

This quick tutorial demonstrates how to use built-in property naming strategies and how to create a custom one.

Customizing Docker Images

Back in the day, when I was beginning to work on public-facing projects, setting up a development environment was really tedious. You have to install all the required software’s on the host machine. Relocating a project from one host to another sometimes comes to be the real work.

Now, the trend seems to have been changed. Once you want to work on a project, you start setting up a virtual machine on a remote computer that your company provides or a local virtual machine (at least in my company people prefer to work on virtual machines). There are many benefits, but one that I use all the time is the ability to take a virtual machine from one host and run it on a different one. Other than that, the ability to have multiple operating systems is very valuable for both development and testing.