JPA delegates can throw NoResultException when entity doesn't have any attributes

Closes #10067
This commit is contained in:
vramik 2022-02-08 13:59:45 +01:00 committed by Hynek Mlnařík
parent 1b77358160
commit 5701c6c85a
3 changed files with 3 additions and 3 deletions

View file

@ -57,7 +57,7 @@ public class JpaClientDelegateProvider extends JpaDelegateProvider<JpaClientEnti
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<JpaClientEntity> query = cb.createQuery(JpaClientEntity.class);
Root<JpaClientEntity> root = query.from(JpaClientEntity.class);
root.fetch("attributes", JoinType.INNER);
root.fetch("attributes", JoinType.LEFT);
query.select(root).where(cb.equal(root.get("id"), UUID.fromString(getDelegate().getId())));
setDelegate(em.createQuery(query).getSingleResult());

View file

@ -55,7 +55,7 @@ public class JpaClientScopeDelegateProvider extends JpaDelegateProvider<JpaClien
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<JpaClientScopeEntity> query = cb.createQuery(JpaClientScopeEntity.class);
Root<JpaClientScopeEntity> root = query.from(JpaClientScopeEntity.class);
root.fetch("attributes", JoinType.INNER);
root.fetch("attributes", JoinType.LEFT);
query.select(root).where(cb.equal(root.get("id"), UUID.fromString(getDelegate().getId())));
setDelegate(em.createQuery(query).getSingleResult());

View file

@ -55,7 +55,7 @@ public class JpaRoleDelegateProvider extends JpaDelegateProvider<JpaRoleEntity>
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<JpaRoleEntity> query = cb.createQuery(JpaRoleEntity.class);
Root<JpaRoleEntity> root = query.from(JpaRoleEntity.class);
root.fetch("attributes", JoinType.INNER);
root.fetch("attributes", JoinType.LEFT);
query.select(root).where(cb.equal(root.get("id"), UUID.fromString(getDelegate().getId())));
setDelegate(em.createQuery(query).getSingleResult());