abh1sar commented on code in PR #11531:
URL: https://github.com/apache/cloudstack/pull/11531#discussion_r2309251761


##########
engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDaoImpl.java:
##########
@@ -18,83 +18,48 @@
 
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.TimeZone;
 
 
-import com.cloud.exception.CloudException;
+import javax.annotation.PostConstruct;
+
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.usage.UsageVolumeVO;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.TransactionLegacy;
 
 @Component
 public class UsageVolumeDaoImpl extends GenericDaoBase<UsageVolumeVO, Long> 
implements UsageVolumeDao {
     public static final Logger s_logger = 
Logger.getLogger(UsageVolumeDaoImpl.class.getName());
 
-    protected static final String REMOVE_BY_USERID_VOLID = "DELETE FROM 
usage_volume WHERE account_id = ? AND volume_id = ?";
-    protected static final String UPDATE_DELETED = "UPDATE usage_volume SET 
deleted = ? WHERE account_id = ? AND volume_id = ? and deleted IS NULL";
-    protected static final String GET_USAGE_RECORDS_BY_ACCOUNT = "SELECT 
volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, size, 
created, deleted "
+    protected static final String GET_USAGE_RECORDS_BY_ACCOUNT = "SELECT 
volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, 
vm_id, size, created, deleted "
         + "FROM usage_volume " + "WHERE account_id = ? AND ((deleted IS NULL) 
OR (created BETWEEN ? AND ?) OR "
         + "      (deleted BETWEEN ? AND ?) OR ((created <= ?) AND (deleted >= 
?)))";
-    protected static final String GET_USAGE_RECORDS_BY_DOMAIN = "SELECT 
volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, size, 
created, deleted "
+    protected static final String GET_USAGE_RECORDS_BY_DOMAIN = "SELECT 
volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, 
vm_id, size, created, deleted "
         + "FROM usage_volume " + "WHERE domain_id = ? AND ((deleted IS NULL) 
OR (created BETWEEN ? AND ?) OR "
         + "      (deleted BETWEEN ? AND ?) OR ((created <= ?) AND (deleted >= 
?)))";
-    protected static final String GET_ALL_USAGE_RECORDS = "SELECT volume_id, 
zone_id, account_id, domain_id, disk_offering_id, template_id, size, created, 
deleted "
+    protected static final String GET_ALL_USAGE_RECORDS = "SELECT volume_id, 
zone_id, account_id, domain_id, disk_offering_id, template_id, vm_id, size, 
created, deleted "
         + "FROM usage_volume " + "WHERE (deleted IS NULL) OR (created BETWEEN 
? AND ?) OR " + "      (deleted BETWEEN ? AND ?) OR ((created <= ?) AND 
(deleted >= ?))";
+    private SearchBuilder<UsageVolumeVO> volumeSearch;
 
     public UsageVolumeDaoImpl() {
     }
 
-    @Override

Review Comment:
   This kind of update method is not required since 
https://github.com/apache/cloudstack/pull/5785 added auto-increment primary 
keys. We can directly use the GenericDao.update()



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to