Skip to content

Commit

Permalink
Bug fix for building SQL from AssetQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
richturner committed Nov 11, 2018
1 parent e726d28 commit 399e9dd
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -483,7 +483,7 @@ public boolean isDescendantAssets(String parentAssetId, List<String> assetIds) {
return persistenceService.doReturningTransaction(entityManager -> {
try {
return entityManager.createQuery(
"select count(a) from Asset a where :parentAssetId = any(get_asset_tree_path(a.ID)) AND a.id IN :assetIds",
"select count(a) from Asset a where :parentAssetId = a.PATH AND a.id IN :assetIds",
Long.class)
.setParameter("parentAssetId", parentAssetId)
.setParameter("assetIds", assetIds)
Expand Down Expand Up @@ -937,7 +937,7 @@ protected String buildWhereClause(BaseAssetQuery query, int level, List<Paramete
binders.add(st -> st.setString(pos, query.tenant.realm));
}

if (query.userId != null) {
if (query.ids == null && query.userId != null) {
sb.append(" and ua.ASSET_ID = a.ID and ua.USER_ID = ?");
final int pos = binders.size() + 1;
binders.add(st -> st.setString(pos, query.userId));
Expand Down

0 comments on commit 399e9dd

Please sign in to comment.