Topics: java

Hibernate @NotBlank vs @NotEmpty

  Sometimes we may often overlook at the difference between these two useful annotations for Hibernate. @NotBlank versus @NotEmpty. Validate that the annotated string is not null or empty. The difference to NotEmpty is that trailing whitespaces are getting ignored. The answer can be found at Hibernate Doc for @NotBlank :)

Dreadful Undefined JRE_HOME

A reminder. JRE_HOME environment variable should point to the JRE root directory instead of the bin directory. In Windows command prompt you may do the following: c:\> set JRE_HOME=[your path name to JRE] A common error from running startup.bat or catalina.bat for Tomcat. The JRE_HOME environment variable is not defined correctly

Wildcard in Generics for Java

One thing interesting I learnt today is the scope of Wildcard Generics. Let say both CheckingAccount and SavingsAccount are extended (inherited) from Account: import com.mybank.domain.*; import java.util.*; public class TestCovariance { public static void printNames(List lea) { for (int i=0; i < lea.size(); i++) { System.out.println(lea.get(i).getName()); //lea only able to access methods from immediate parent […]