Guide to Hibernate’s @TimeZoneStorage Annotation
1. Overview When building our persistence layer with Hibernate and working with timestamp fields, we often need to handle timezone details as well. Since Java 8, the most common approach to represent...
View ArticleWriting JDBC ResultSet to an Excel File Using Apache POI
1. Overview Data handling is one of the critical tasks in software development. A common use case is retrieving data from a database and exporting it into a format for further analysis such as Excel...
View ArticleFormat Output in a Table Format Using System.out
1. Overview In Java applications, it’s often necessary to display data in a table-like format. System.out offers several ways to do this, from simple string concatenation to advanced formatting...
View ArticleHow to Make a Field Optional in JPA Entity?
1. Overview When working with databases and Spring Data, it’s common to encounter scenarios where not all fields in an entity are necessary for every operation. Therefore, we might want to make some...
View ArticleAssert Collection of JSON Objects Ignoring Order
1. Introduction Asserting that collections of JSON objects are equal can be challenging, especially when the order of elements within the collection isn’t guaranteed. While libraries like Jackson and...
View ArticleEfficient Way to Insert a Number Into a Sorted Array of Numbers in Java
1. Overview The usage of arrays is very common in programming languages. Inserting and removing elements from an array of numbers is a basic operation we often need. Inserting an element into a sorted...
View ArticleHow to Handle Alerts and Popups in Selenium
1. Overview In this tutorial, we’ll explore how to handle alerts and popups in Selenium. Alerts and popups are common elements that can interrupt the flow of automated scripts, so managing them...
View ArticleMasking a String Except the Last N Characters
1. Overview In Java, we often need to mask a String, for example to hide sensitive information printed in log files or displayed to the user. In this tutorial, we’ll explore how to accomplish this...
View ArticleHow to Clone a JPA Entity
1. Introduction Cloning a JPA entity means creating a copy of an existing entity. This allows us to make changes to a new entity without affecting the original object. In this tutorial, we’ll explore...
View ArticleHow to Check if Multiplying Two Numbers in Java Will Cause an Overflow
1. Overview In Java, multiplying two numbers can lead to overflow if the result exceeds the limits of the data type (int or long). Java 8 introduced Math.multiplyExact(), automatically detecting...
View ArticleHow to Replace Deprecated JWT parser().setSigningKey()
1. Overview The Java JWT (JSON Web Token) library is a tool for creating, parsing, and validating JWT tokens. These tokens secure APIs and web applications and are a common solution for authentication...
View ArticleHow to Append a Newline to a StringBuilder
1. Overview In this tutorial, we’re going to explore how to append newlines to a StringBuilder. First, we’ll discuss why hard-coding newlines isn’t reliable across operating systems. Then, we’ll dive...
View ArticleHandling Kafka Producer TimeOutException with Java
1. Overview In this tutorial, we’ll learn how to handle TimeOutException in Kafka Producer. Firstly, let’s go through possible scenarios when TimeOutException occurs, and then see how to tackle the...
View ArticleHow to Count Lines of Java Code Using IntelliJ IDEA?
1. Overview IntelliJ IDEA is a popular integrated development environment (IDE) for Java programming. It’s best known for its powerful features and user-friendly interface. To count lines of Java code...
View ArticleChatClient Fluent API in Spring AI
1. Overview In this tutorial, we’ll explore the fluent API of ChatClient, a feature of the Spring AI module version 1.0.0 M1. The ChatClient interface from the Spring AI module enables communication...
View ArticleIntroduction to Apache Hadoop
1. Introduction Humanity produces staggering amounts of data daily with the world more connected than ever through social media platforms, messaging apps, and audio/video streaming services. Therefore,...
View ArticleJava Weekly, Issue 562
1. Spring and Java >> AI Meets Spring Petclinic: Implementing an AI Assistant with Spring AI (Part I) [spring.io] Incorporating an AI assistant that allows users to interact with the application...
View ArticleUnderstanding Ramp-up in JMeter
1. Overview JMeter is a very popular solution for testing the performance of JVM applications. One problem we often face in JMeter is how to control the amount of requests we make in a given time....
View ArticleMonitor Java Application Logs With Loggly
1. Overview In this tutorial, we’ll walk through the steps to configure SolarWinds Loggly, a cloud-based log management tool, for Java applications using various logging libraries. We’ll also learn how...
View ArticleMocking an Enum Using Mockito
1. Overview An enum is a special type of class that extends the Enum class. It consists of a group of static final values, which makes them unchangeable. Furthermore, we use enums to define a set of...
View Article