org.hibernate.sql.ast.SqlTreeCreationException: Could not locate TableGroup - com.sfnt.ems.domain.common.User(144949067788000)
SqmBasicValuedSimplePath(com.sfnt.ems.domain.common.User(146863903776100).userId)
{com.sfnt.ems.domain.common.User=StandardTableGroup(com.sfnt.ems.domain.common.User(146971078538600))}
why the bracket number difference here?
You can’t use the same restriction Predicate that you built for one query in the other. You have to rebuild the restriction again, based on the Root/From of the query you want to apply this on.
okay Sir. thanks a lots for replying.
Can i create a new predicate list from existing predicate list of criteria queries, and change root in this new predicate list for my count query in hibernate 6.1.
Here criteriaList is my list of predicates of criteria query. I am trying to create here criteriaCountList with same conditions mentioned in criteriaList, but changing the root for my countQuery:
Hello Sir,
This works perfrect. But if we also making fetch statement in our predicate list, using above code for count query resulting into exception:
org.hibernate.query.SemanticException: query specified join fetching, but the owner of the fetched association was not present in the select list
Since I was getting tired of answering the same questions over and over, I decided to implement count query creation in 6.4: [HHH-17410] - Hibernate JIRA
If you can’t get it to work by rebuilding the query without fetch joins, then you’ll have to wait for 6.4.0.CR2 or 6.4.0.Final.
Hi @beikov sir, I’m still facing Already registered a copy: SqmBasicValuedSimplePath() even after updating to implementation 'org.hibernate:hibernate-core:6.4.1.Final'