Switching Between Frames Using Selenium WebDriver in Java
1. Introduction Managing frames and iframes is a crucial skill for test automation engineers. Selenium WebDriver allows us to work with both frames and iframes in the same way. In this tutorial, we’ll...
View ArticleWhy Is sun.misc.Unsafe.park Actually Unsafe?
1. Overview Java provides certain APIs for internal use and discourages unnecessary use in other cases. The JVM developers gave the packages and classes names such as Unsafe, which should warn...
View ArticleHashSet toArray() Method in Java
1. Introduction HashSet is one of the common data structures that we can utilize in Java Collеctions. In this tutorial, we’ll dive into the toArray() method of the HashSet class, illustrating how to...
View ArticleConvert ResultSet Into Map
1. Introduction Java applications widely use the Java Database Connectivity (JDBC) API to connect and execute queries on a database. ResultSet is a tabular representation of the data extracted by these...
View ArticleMongoDB Atlas Search Using the Java Driver and Spring Data
1. Introduction In this tutorial, we’ll learn how to use Atlas Search functionalities using the Java MongoDB driver API. By the end, we’ll have a grasp on creating queries, paginating results, and...
View ArticleSharing Memory Between JVMs
1. Introduction In this tutorial, we’ll show how to share memory between two or more JVMs running on the same machine. This capability enables very fast inter-process communication since we can move...
View ArticleJava Weekly, Issue 516
1. Spring and Java >> Table partitioning with Spring and Hibernate [vladmihalcea.com] Splitting a large table into multiple smaller partition tables using Spring and Hibernate — allowing a more...
View ArticleCheck If a Java StringBuilder Object Contains a Character
1. Introduction Thе StringBuildеr class in Java provides a flеxiblе and еfficiеnt way to manipulatе strings. In some cases, we nееd to chеck whеthеr a StringBuildеr objеct contains a specific...
View Article@Query Definitions With SpEL Support in Spring Data JPA
1. Overview SpEL stands for Spring Expression Language and is a powerful tool that can significantly enhance our interaction with Spring and provide an additional abstraction over configuration,...
View ArticleJava Weekly, Issue 522
1. Spring and Java >> Hibernate StatelessSession Upsert [vladmihalcea.com] A portable way of performing an upsert using Hibernate StatelessSession’s Upsert method. Interesting. >> This Year...
View ArticleDetermine the Class of a Generic Type in Java
1. Overview Generics, which was released in Java 5, allowed developers to create classes, interfaces, and methods with typed parameters, enabling the writing of type-safe code. Extracting this type of...
View ArticleJava System.currentTimeMillis() Vs. System.nanoTime()
1. Introduction Two commonly used mеthods for timе mеasurеmеnt in Java arе Systеm.currеntTimеMillis() and Systеm.nanoTimе(). Whilе both mеthods providе a way to mеasurе timе, thеy sеrvе diffеrеnt...
View ArticleDead Letter Queue for Kafka With Spring
1. Introduction In this tutorial, we’ll learn how to configure a Dead Letter Queue mechanism for Apache Kafka using Spring. 2. Dead Letter Queues A Dead Letter Queue (DLQ) is used to store messages...
View ArticleUsing XML in @RequestBody in Spring REST
1. Overview While JSON is a de-facto standard for RESTful services, in some cases, we might want to work with XML. We can fall back to XML for different reasons: legacy applications, using a more...
View ArticleReturn Map instead of List in Spring Data JPA
1. Overview Spring JPA provides a very flexible and convenient API for interaction with databases. However, sometimes, we need to customize it or add more functionality to the returned collections....
View ArticleCompress and Uncompress Byte Array Using Deflater/Inflater
1. Overview Data compression is a crucial aspect of software development that enables efficient storage and transmission of information. In Java, the Deflater and Inflater classes from the...
View ArticleDifference Between 1L and (long) 1
1. Overview In this tutorial, we’ll explore the differences between the literal representation of a long type and the conversion of an int value to a long value using the cast operator. 2. Literal...
View ArticleWhen to Use the getReferenceById() and findById() Methods in Spring Data JPA
1. Overview JpaRepository provides us with basic methods for CRUD operations. However, some of them are not so straightforward, and sometimes, it’s hard to identify which method would be the best for a...
View ArticleBind Case Insensitive @Value to Enum in Spring Boot
1. Overview Spring provides us with autoconfiguration features that we can use to bind components, configure beans, and set values from a property source. @Value annotation is useful when we don’t want...
View ArticleFixing Hibernate QueryException: Named Parameter Not Bound
1. Overview In this short tutorial, we’ll shed light on how to solve the Hibernate QueryException: “named parameter not bound”. First, we’ll elucidate the main cause behind the exception. Then, we’ll...
View Article