[Schmitzm-commits] r2365 - trunk/schmitzm-hibernate/src/main/java/de/schmitzm/db/hibernate

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 19 13:04:44 CEST 2013


Author: mojays
Date: 2013-07-19 13:04:44 +0200 (Fri, 19 Jul 2013)
New Revision: 2365

Modified:
   trunk/schmitzm-hibernate/src/main/java/de/schmitzm/db/hibernate/DBUtil.java
Log:
DBUtil.determineEntity(.): BugFix to handle NULL condition

Modified: trunk/schmitzm-hibernate/src/main/java/de/schmitzm/db/hibernate/DBUtil.java
===================================================================
--- trunk/schmitzm-hibernate/src/main/java/de/schmitzm/db/hibernate/DBUtil.java	2013-07-19 09:12:55 UTC (rev 2364)
+++ trunk/schmitzm-hibernate/src/main/java/de/schmitzm/db/hibernate/DBUtil.java	2013-07-19 11:04:44 UTC (rev 2365)
@@ -257,7 +257,10 @@
           throw new IllegalArgumentException("Criteria parameter "+i+" must be a property name (String): "+LangUtil.getSimpleClassName(crit[i]));
         String propName  = (String)crit[i];
         Object propValue = crit[i+1];
-        query.add(Restrictions.eq(propName, propValue));
+        if ( propValue != null )
+          query.add(Restrictions.eq(propName, propValue));
+        else
+          query.add(Restrictions.isNull(propName));
       }
       List<E> resultList = (List<E>) query.list();
 



More information about the Schmitzm-commits mailing list