How to ignore null values using springframework BeanUtils copyProperties?

You can create your own method to copy properties while ignoring null values. public static String[] getNullPropertyNames (Object source) { final BeanWrapper src = new BeanWrapperImpl(source); java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors(); Set<String> emptyNames = new HashSet<String>(); for(java.beans.PropertyDescriptor pd : pds) { Object srcValue = src.getPropertyValue(pd.getName()); if (srcValue == null) emptyNames.add(pd.getName()); } String[] result = new String[emptyNames.size()]; … Read more

MySQL SELECT only not null values

You should use IS NOT NULL. (The comparison operators = and <> both give UNKNOWN with NULL on either side of the expression.) SELECT * FROM table WHERE YourColumn IS NOT NULL; Just for completeness I’ll mention that in MySQL you can also negate the null safe equality operator but this is not standard SQL. … Read more