Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 66be91e

Browse files
committedMay 7, 2025·
Fix DatabaseException on query
1 parent 47b52e8 commit 66be91e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎openid-connect-common/src/main/java/org/mitre/oauth2/model/AuthenticationHolderEntity.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@
5353
@Entity
5454
@Table(name = "authentication_holder")
5555
@NamedQueries ({
56-
@NamedQuery(name = AuthenticationHolderEntity.QUERY_ALL, query = "select a from AuthenticationHolderEntity a"),
57-
@NamedQuery(name = AuthenticationHolderEntity.QUERY_GET_UNUSED, query = "SELECT a FROM AuthenticationHolderEntity a "
58-
+ "LEFT JOIN OAuth2AccessTokenEntity t ON t.authenticationHolder.id = a.id "
59-
+ "LEFT JOIN OAuth2RefreshTokenEntity r ON r.authenticationHolder.id = a.id "
60-
+ "LEFT JOIN AuthorizationCodeEntity c ON c.authenticationHolder.id = a.id "
61-
+ "WHERE t.authenticationHolder.id IS NULL AND r.authenticationHolder.id IS NULL AND c.authenticationHolder.id IS NULL")
56+
@NamedQuery(name = AuthenticationHolderEntity.QUERY_ALL, query = "select a from AuthenticationHolderEntity a"),
57+
@NamedQuery(name = AuthenticationHolderEntity.QUERY_GET_UNUSED, query = "select a from AuthenticationHolderEntity a where " +
58+
"a.id not in (select t.authenticationHolder.id from OAuth2AccessTokenEntity t) and "
59+
+ "a.id not in (select r.authenticationHolder.id from OAuth2RefreshTokenEntity r) and "
60+
+ "a.id not in (select c.authenticationHolder.id from AuthorizationCodeEntity c)")
6261
})
6362
public class AuthenticationHolderEntity implements Serializable {
6463
private static final Logger logger = LoggerFactory.getLogger(AuthenticationHolderEntity.class);

0 commit comments

Comments
 (0)
Please sign in to comment.