Skip to content
Snippets Groups Projects
Commit 76e8c3a7 authored by Moritz Staudinger's avatar Moritz Staudinger
Browse files

set id correctly

parent 60fdf6dc
Branches
Tags
2 merge requests!81New stable release,!43Merge dev to master
...@@ -148,7 +148,7 @@ public class StoreServiceImpl extends HibernateConnector implements StoreService ...@@ -148,7 +148,7 @@ public class StoreServiceImpl extends HibernateConnector implements StoreService
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Query update(Long containerId, Long databaseId, QueryResultDto result, Long resultNumber, Query metadata) public Query update(Long containerId, Long databaseId, QueryResultDto result, Long resultNumber, Query query)
throws QueryStoreException, DatabaseNotFoundException, ImageNotSupportedException, throws QueryStoreException, DatabaseNotFoundException, ImageNotSupportedException,
ContainerNotFoundException { ContainerNotFoundException {
/* find */ /* find */
...@@ -158,21 +158,14 @@ public class StoreServiceImpl extends HibernateConnector implements StoreService ...@@ -158,21 +158,14 @@ public class StoreServiceImpl extends HibernateConnector implements StoreService
throw new ImageNotSupportedException("Currently only MariaDB is supported"); throw new ImageNotSupportedException("Currently only MariaDB is supported");
} }
log.debug("Update database id {}, metadata {}", databaseId, metadata); log.debug("Update database id {}, metadata {}", databaseId, query);
/* save */ /* save */
final SessionFactory factory = getSessionFactory(database, true); final SessionFactory factory = getSessionFactory(database, true);
final Session session = factory.openSession(); final Session session = factory.openSession();
final Transaction transaction = session.beginTransaction(); final Transaction transaction = session.beginTransaction();
final Query query = Query.builder() query.setQueryHash(DigestUtils.sha256Hex(query.getQuery()));
.cid(containerId) query.setResultNumber(resultNumber);
.dbid(databaseId) query.setResultHash(storeMapper.queryResultDtoToString(result));
.query(metadata.getQuery())
.queryNormalized(metadata.getQuery())
.queryHash(DigestUtils.sha256Hex(metadata.getQuery()))
.resultNumber(resultNumber)
.resultHash(storeMapper.queryResultDtoToString(result))
.execution(metadata.getExecution())
.build();
session.update(query); session.update(query);
transaction.commit(); transaction.commit();
/* store the result in the query store */ /* store the result in the query store */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment