Skip to content

Commit 804d8aa

Browse files
author
j.bebendorf
committed
Fixed issue with empty where in combination with the accessible
1 parent 75d8596 commit 804d8aa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/org/javawebstack/orm/wrapper/builder/MySQLQueryStringBuilder.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ public SQLQueryString buildQuery(Query<?> query) {
6161
QueryGroup<?> where = query.getWhereGroup();
6262
checkWithDeleted(repo, query.isWithDeleted(), where);
6363
if(query.shouldApplyAccessible()) {
64+
if(where.getQueryElements().isEmpty()) {
65+
try {
66+
where = (QueryGroup<Model>) accessibleAccessMethod.invoke(repo.getAccessible(), query, where, query.getAccessor());
67+
} catch (IllegalAccessException | InvocationTargetException e) {
68+
throw new ORMQueryException(e);
69+
}
70+
}
6471
QueryGroup<?> actualWhere = where;
6572
where = new QueryGroup<>()
6673
.and(q -> (QueryGroup<Model>) actualWhere)
@@ -71,6 +78,7 @@ public SQLQueryString buildQuery(Query<?> query) {
7178
throw new ORMQueryException(e);
7279
}
7380
});
81+
7482
}
7583
if (!where.getQueryElements().isEmpty()) {
7684
SQLQueryString qs = convertGroup(repo.getInfo(), where);

0 commit comments

Comments
 (0)