Daniel Novo (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ae986b...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiY2I4ZGNiODVl...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16622?atlOrigin=eyJpIjoiY2I4ZG...
) HHH-16622 (
https://hibernate.atlassian.net/browse/HHH-16622?atlOrigin=eyJpIjoiY2I4ZG...
) Criteria API - Already registered a copy (
https://hibernate.atlassian.net/browse/HHH-16622?atlOrigin=eyJpIjoiY2I4ZG...
)
Change By: Daniel Novo (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ae986b...
)
With Criteria API, reusing Predicates with subqueries we are getting this error:
{noformat}Already registered a copy:
org.hibernate.query.sqm.tree.select.SqmSubQuery@4416e18d{noformat}
Without subqueries, we are getting other error
{noformat}org.hibernate.sql.ast.SqlTreeCreationException: Could not locate
TableGroup{noformat}
Sample:
{noformat}CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<MyEntity> cq = cb.createQuery(MyEntity.class);
Root<MyEntity> root = cq.from(MyEntity.class);
List<Predicate> predicates = getPredicates(cb,cq, root, "1");
cq.select(root).where(predicates.toArray(Predicate[]::new));
TypedQuery<MyEntity> q = entityManager.createQuery(cq);
long count = count(entityManager, predicates);{noformat}
Same code in hibernate 5 works fine.
Test case:
[
https://github.com/DanielNovo/hibernate-test-case-templates/commit/e6b5f4...]
(
https://hibernate.atlassian.net/browse/HHH-16622#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16622#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:11e4e77 )