TEXT PACKAGE / NOTES</>↗Text Package06 Feb 2024
In Java, the NumberFormat class of java.text package can be used to format numbers. For formatting a number as a percentage string with fraction digits, you can use the getPercentInstance() method that returns a percentage format for the current default Locale. Here is a sample code snippet showing how to format a number as a […]
ITEXT PDF / NOTES</>↗iText PDF05 Feb 2024
When it comes to generating PDF documents dynamically, iText 8 is a powerful and versatile Java library that provides a wide range of functionalities. One common requirement in PDF generation is the need to include tables to present structured data. In this blog post, we will explore how to create a table in a PDF […]
UTIL PACKAGE / NOTES</>↗Util Package27 Jan 2024
The forEach() method in ConcurrentHashMap is used for iteration over the entries in the map. The method takes a BiConsumer as an argument, which is a functional interface that represents an operation that accepts two input arguments and returns no result. Here’s an example of how to use forEach() with a ConcurrentHashMap: package org.kodejava.util.concurrent; import […]
UTIL PACKAGE / NOTES</>↗Util Package26 Jan 2024
The ConcurrentHashMap is a class in Java that implements the ConcurrentMap interface. It is part of the Java Collection Framework and extends the AbstractMap class. ConcurrentHashMap is thread-safe, which means it is designed to support high concurrency levels by handling multiple threads concurrently without any inconsistencies. It allows multiple threads to perform retrieve (get) and […]
JAVA PERSISTENCE API / NOTES</>↗Java Persistence API26 Jan 2024
Using Spring Data’s @Query annotation with native SQL queries can have several impacts on Hibernate or JPA persistence context: Bypassing JPQL Translation: When you use a native SQL query with @Query, you bypass JPQL (Java Persistence Query Language) translation. This means that the query is written in the native SQL dialect of the underlying database, […]
JAVA PERSISTENCE API / NOTES</>↗Java Persistence API26 Jan 2024
No, you typically don’t need to explicitly call the save() method in Hibernate or JPA to save entities. In JPA, when you modify a managed entity (an entity that was retrieved or persisted by the entity manager), the changes are automatically synchronized with the database when the transaction commits. Hibernate, being an implementation of JPA, […]