Skip to content

Commit 03aca88

Browse files
ustcweizhouRohit Yadav
authored andcommitted
CLOUDSTACK-8186: make setRemoved to null possible
1 parent de0d1c7 commit 03aca88

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ public long addTemplateToZone(VMTemplateVO tmplt, long zoneId) {
771771
tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new Date());
772772
_templateZoneDao.persist(tmpltZoneVO);
773773
} else {
774-
tmpltZoneVO.setRemoved(null);
774+
tmpltZoneVO.setRemoved(GenericDaoBase.DATE_TO_NULL);
775775
tmpltZoneVO.setLastUpdated(new Date());
776776
_templateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
777777
}

framework/db/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1212
<modelVersion>4.0.0</modelVersion>
1313
<artifactId>cloud-framework-db</artifactId>
14-
<name>Apache CloudStack Framework - Event Notification</name>
14+
<name>Apache CloudStack Framework - Database</name>
1515
<parent>
1616
<groupId>org.apache.cloudstack</groupId>
1717
<artifactId>cloudstack-framework</artifactId>

framework/db/src/com/cloud/utils/db/GenericDaoBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
158158
protected static final String FOR_UPDATE_CLAUSE = " FOR UPDATE ";
159159
protected static final String SHARE_MODE_CLAUSE = " LOCK IN SHARE MODE";
160160
protected static final String SELECT_LAST_INSERT_ID_SQL = "SELECT LAST_INSERT_ID()";
161+
public static final Date DATE_TO_NULL = new Date(Long.MIN_VALUE);
161162

162163
protected static final SequenceFetcher s_seqFetcher = SequenceFetcher.getInstance();
163164

@@ -1537,7 +1538,7 @@ protected void prepareAttribute(final int j, final PreparedStatement pstmt, fina
15371538
}
15381539
} else if (attr.field.getType() == Date.class) {
15391540
final Date date = (Date)value;
1540-
if (date == null) {
1541+
if (date == null || date.equals(DATE_TO_NULL)) {
15411542
pstmt.setObject(j, null);
15421543
return;
15431544
}

0 commit comments

Comments
 (0)