In JPA, the use of @Version allows us to use Optimistic Locking wherein no real locks are actually applied to the database when updating records.
Java Compare Multidimensional Arrays Of Reference Types
This post shows how to compare two multidimensional arrays of reference types in Java. The codes will examine if they are the same in terms of element values and their locations. For example, we want to compare a modified array
Java – Beyond String Pool
The String Pool is a location in the Java Virtual Machine (JVM) that collects all the literal Strings from your codes. Java keeps unique Strings for reuse.
Spring Boot + Spring Security with Multiple Login Forms and User Types
I’m working on some personal project that handles 4 different user types (e.g., students, instructors, registrar employees, security personnel). Each user type are stored in a separate user table. With this, I require four (4) login forms.
Eclipse – Highlight selected text
I’ve been using this copy of Eclipse Mars since last year but only noticed today that selected texts are not highlighted. So, I thought maybe they made it configurable or turned off by default.
Array-backed Lists in Java
In Java, there are these array-backed lists that are generated when you convert arrays to lists using Arrays.asList(…). The list and the array objects point to the same data stored in the heap. Changes to the existing contents through either the list or array result to changing the same data.
Java Primitive Float And Double – What’s the difference?
Any floating-point literal in Java is by default of a double type.
Java – How to pass argument string with spaces to Java
The way you run your application in Java is by invoking java followed by the class name (without the .class extension).
Using @Query to execute a MySQL function
Using @Query to execute a MySQL function as follows. Here is an example that uses Spring Data @Query to execute a MySQL function that returns a string value. Let’s say we have a MySQL function that returns a predefined text.
Connecting Tomcat 7 Web Application to Database Using JNDI
Several weeks ago, I looked at the some decompiled Java codes from a fairly small web application that basically records cheque numbers and generates reports. To my surprise, it was written in dreadful codes full of clutter and signs of haste! I almost cried. Just imagine the following code littered all around the application and entangled by a lot of package-level instance variables. Not to mention the SQL-statements-in-Servlets type of design pattern.