diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java index 58922fe3f51..2037b3d35f7 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 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 d26f9fe68c8..e2bd79ace15 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"> 4.0.0 cloud-framework-db - Apache CloudStack Framework - Event Notification + Apache CloudStack Framework - Database org.apache.cloudstack cloudstack-framework diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java index f1b8d0d4dc8..c5a4cd85dd8 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 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 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; }