JAVA PERSISTENCE API / CATATAN</>↗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 / CATATAN</>↗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, […]
CORE API / CATATAN</>↗Core API26 Jan 2024
Whitespace characters in Java (or programming in general) aren’t just the space ' ' character. It also includes other characters that create some form of space or break in the text. The most common ones include: space ' ' tab '\t' newline '\n' carriage return '\r' form feed '\f'. All these characters fall into the […]
JAVA 8 / CATATAN</>↗Java 826 Jan 2024
In Java, you can use the removeIf() method to remove elements from a Set-based in a certain condition. Here’s how you can do it: First, get the entry set from the map. The entry set is a Set<Map.Entry<K,V>>. Then, call removeIf() on this set. The removeIf() method takes a predicate, which is a condition that […]
JAVA 8 / CATATAN</>↗Java 825 Jan 2024
You can use putAll() method provided by the Map interface to merge entries of two separate Map objects. The putAll() method copies all the mappings from the specified map to the current map. Pre-existing mappings in the current map are replaced by the mappings from the specified map. Here is a Java code example: package […]
JAVA 8 / CATATAN</>↗Java 825 Jan 2024
In Java, the Map interface provides the methods replace() and replaceAll(), which are used to replace existing entries in the map. Replace: replace(K key, V value) is a method that replaces the entry for the specified key only if it is currently mapped to some value. It returns the old value associated with the specified […]