This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch 4.9
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.9 by this push:
     new 03aca88  CLOUDSTACK-8186: make setRemoved to null possible
03aca88 is described below

commit 03aca885ae9ce53232d0ba3759d14737ba40f288
Author: Wei Zhou <[email protected]>
AuthorDate: Fri Apr 14 22:41:17 2017 +0800

    CLOUDSTACK-8186: make setRemoved to null possible
---
 engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java | 2 +-
 framework/db/pom.xml                                           | 2 +-
 framework/db/src/com/cloud/utils/db/GenericDaoBase.java        | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java 
b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
index 58922fe..2037b3d 100644
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -771,7 +771,7 @@ public class VMTemplateDaoImpl extends 
GenericDaoBase<VMTemplateVO, Long> implem
             tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new 
Date());
             _templateZoneDao.persist(tmpltZoneVO);
         } else {
-            tmpltZoneVO.setRemoved(null);
+            tmpltZoneVO.setRemoved(GenericDaoBase.DATE_TO_NULL);
             tmpltZoneVO.setLastUpdated(new Date());
             _templateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
         }
diff --git a/framework/db/pom.xml b/framework/db/pom.xml
index 421ca5f..137e479 100644
--- a/framework/db/pom.xml
+++ b/framework/db/pom.xml
@@ -11,7 +11,7 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>cloud-framework-db</artifactId>
-  <name>Apache CloudStack Framework - Event Notification</name>
+  <name>Apache CloudStack Framework - Database</name>
   <parent>
     <groupId>org.apache.cloudstack</groupId>
     <artifactId>cloudstack-framework</artifactId>
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java 
b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index f1b8d0d..c5a4cd8 100644
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -158,6 +158,7 @@ public abstract class GenericDaoBase<T, ID extends 
Serializable> extends Compone
     protected static final String FOR_UPDATE_CLAUSE = " FOR UPDATE ";
     protected static final String SHARE_MODE_CLAUSE = " LOCK IN SHARE MODE";
     protected static final String SELECT_LAST_INSERT_ID_SQL = "SELECT 
LAST_INSERT_ID()";
+    public static final Date DATE_TO_NULL = new Date(Long.MIN_VALUE);
 
     protected static final SequenceFetcher s_seqFetcher = 
SequenceFetcher.getInstance();
 
@@ -1537,7 +1538,7 @@ public abstract class GenericDaoBase<T, ID extends 
Serializable> extends Compone
             }
         } else if (attr.field.getType() == Date.class) {
             final Date date = (Date)value;
-            if (date == null) {
+            if (date == null || date.equals(DATE_TO_NULL)) {
                 pstmt.setObject(j, null);
                 return;
             }

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to