summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db/src/main/java
diff options
context:
space:
mode:
authorYulian Han <elaine.hanyulian@huawei.com>2018-04-19 11:11:35 +0800
committerYulian Han <elaine.hanyulian@huawei.com>2018-04-19 06:08:38 +0000
commitf26e7748ceab6de3c47959798e545c7a71e49433 (patch)
tree2f69813915e0f4ab732a048949187aa63e4b7752 /mso-api-handlers/mso-requests-db/src/main/java
parent45ec1c516b5f5217dbfb8bdcf9f04d187e013d21 (diff)
getOperationStatusByServiceId db result is list
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064302 Issue-ID: SO-578 Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/main/java')
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index f69378ec65..9964b93df4 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -643,13 +643,17 @@ public class RequestsDatabase {
msoLogger.debug("Execute query on infra active request table");
OperationStatus operStatus = null;
+ List<Object> list = null;
Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
try {
session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id";
+ String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc";
Query query = session.createQuery(hql);
query.setParameter("service_id", serviceId);
- operStatus = (OperationStatus)query.uniqueResult();
+ list = query.list();
+ if(list != null && list.size() >= 1) {
+ operStatus = (OperationStatus) list.get(0);
+ }
} finally {
if(session != null && session.isOpen()) {