Issues
- CTE query cycle attribute still evaluated incorrectly on MSSQL using collation "Latin1_General_CI_AS"HHH-17639Resolved issue: HHH-17639Christian Beikov
- UnsupportedOperationException when registering CompositeUserType with TypeContributor.contributeTypeHHH-17635Resolved issue: HHH-17635Jan Schatteman
- AssertionError when updating entity with lazy loading property and bytecode enhancementHHH-17632Resolved issue: HHH-17632Andrea Boriero
- Ordering collection @OrderBy based on association failsHHH-17623Resolved issue: HHH-17623Christian Beikov
- UnsupportedOperationException when merging an entity with a @Any mappingHHH-17621Resolved issue: HHH-17621Andrea Boriero
- Discriminator-based multitenancy filter is not enabled in a stateless sessionHHH-17619Resolved issue: HHH-17619Marko Bekhta
- After upgrading to to hibernate 6.3.2 finding relations with non abstract parent class fails.HHH-17618Resolved issue: HHH-17618
- Move resources to the src/resources foldersHHH-17616Resolved issue: HHH-17616Jan Schatteman
- @SoftDelete query problem with Joined Inheritance hierarchy structureHHH-17615Resolved issue: HHH-17615Marco Belladelli
- Cannot resolve path of nested generic mapped-superclass joinsHHH-17606Resolved issue: HHH-17606Marco Belladelli
- SetParameterList: Binding is multi-valued; illegalHHH-17599Resolved issue: HHH-17599
- select BigInteger with "IN" clause not possible in hibernate-core 6.4.1 - causing exceptionHHH-17590Resolved issue: HHH-17590
- ClassCastException when calling generic typed method on proxyHHH-17578Resolved issue: HHH-17578Jan Schatteman
- Exception on query: Could not convert ‘java.util.Currency’ to ‘java.util.Currency’ using ‘org.hibernate.type.descriptor.java.CurrencyJavaType’ to wrapHHH-17574Resolved issue: HHH-17574H. Lo
- Persist of entity with ToOne association which contains an embeddable with associated collection fails with SemanticExceptionHHH-17572Resolved issue: HHH-17572Marco Belladelli
- Binding parameter list to BigInteger/BigDecimal field throws ExceptionHHH-17569Resolved issue: HHH-17569
- addNamedQuery leads to "Named query exists, but did not specify a resultClass"HHH-17566Resolved issue: HHH-17566Marco Belladelli
- ArrayIndexOutOfBoundsException in DirtyHelper.isModified()HHH-17560Resolved issue: HHH-17560Andrea Boriero
- Criteria query with nested dynamic instantiations and sorting is not workingHHH-17530Resolved issue: HHH-17530Marco Belladelli
- Explicit selection of an @Embeddable property containing associated collections doesn't workHHH-17528Resolved issue: HHH-17528Marco Belladelli
- DynamicInstantiationResult wrong java type constructor selectedHHH-17515Resolved issue: HHH-17515Marco Belladelli
- The @SoftDelete HQL join entity does not generate a delete conditionHHH-17511Resolved issue: HHH-17511Jan Schatteman
- Could not convert 'java.time.Year' to 'java.time.Year' using 'org.hibernate.type.descriptor.java.YearJavaType' to wrapHHH-17507Resolved issue: HHH-17507H. Lo
- Inconsistent handling of enum fieldsHHH-17496Resolved issue: HHH-17496Craig Muchinsky
- IN predicate with numeric/decimal parameter types leads to Binding is multi-valued; illegal call to #getBindValueHHH-17492Resolved issue: HHH-17492Marco Belladelli
- NOT IN clause does not work with empty listHHH-17490Resolved issue: HHH-17490Marco Belladelli
- Nested subtypes filtered out in bidirectional OneToMany association loadHHH-17483Resolved issue: HHH-17483Marco Belladelli
- OneToMany load empty collection due to discriminator in Polymorphic relationshipHHH-17481Resolved issue: HHH-17481
- QueryArgumentException when using a proxy as parameter value in a queryHHH-17467Resolved issue: HHH-17467Marco Belladelli
- UnsupportedOperationException when using JAKARTA_JDBC_URLHHH-17463Resolved issue: HHH-17463Andrea Boriero
- Trim function not escaping single quotes and not allowing input parameters as trim characterHHH-17435Resolved issue: HHH-17435Marco Belladelli
- Fix typos in javadocHHH-17396Resolved issue: HHH-17396zinzoddari
- Refresh with PESSIMISTIC_WRITE ignored for lazy loaded entityHHH-17395Resolved issue: HHH-17395Andrea Boriero
- Adding support for Union All in IncrementGeneratorHHH-17327Resolved issue: HHH-17327Ankit Agarwal
- Hibernate 6 ListResultsConsumer.Results#addUnique really slow for ElementCollectionsHHH-17307Resolved issue: HHH-17307Andrea Boriero
- More realistic testcase for HHH-16180HHH-17303Resolved issue: HHH-17303Jon Harper
- Stackoverflow error on jpamodelgen generationHHH-17253Resolved issue: HHH-17253Christian Beikov
- Varchar(1) column for Java Enum fails with ClassCastExceptionHHH-17106Resolved issue: HHH-17106Christian Beikov
- Envers RevisionListener is not created when Hibernate CDI Extensions are enabledHHH-16881Resolved issue: HHH-16881Manuel Garcia de Vinuesa
- Query toHqlString() loses function argumentsHHH-16526Resolved issue: HHH-16526Bastien Jansen
- EntityKey 'null identifier' should not happenHHH-14821Resolved issue: HHH-14821
- Support binding null UUID sql parameter with PostgreSQLHHH-14358Resolved issue: HHH-14358Jan Schatteman
- refresh with LockMode on an unitialized proxy does not workHHH-1645Resolved issue: HHH-1645Andrea Boriero
43 of 43
CTE query cycle attribute still evaluated incorrectly on MSSQL using collation "Latin1_General_CI_AS"
Fixed
Description
Details
Assignee
Christian BeikovChristian BeikovReporter
MKMKComponents
Sprint
NoneFix versions
Affects versions
Priority
Major
Details
Details
Assignee
Christian Beikov
Christian BeikovReporter
MK
MKComponents
Sprint
None
Fix versions
Affects versions
Priority
Created January 11, 2024 at 2:56 PM
Updated January 18, 2024 at 1:38 PM
Resolved January 15, 2024 at 5:38 AM
Activity
Show:
MKJanuary 15, 2024 at 11:33 AM
@Christian Beikov I have tested our use case with a snapshot from today and it finally worked, thank you very much!
MKJanuary 12, 2024 at 9:23 AM
@Christian Beikov Wow, thank you for taking another look so quickly! In our tests we noticed that it works to either cast the char(0) to varbinary instead of varchar or to collate the char(0) to a collation that is known to work.
Christian BeikovJanuary 12, 2024 at 9:11 AM
I was able to boil this behavior down to the following simple test:
select
IIF(t.x collate Latin1_General_CI_AS like ('%11%'), 1, 0),
IIF(t.x collate SQL_Latin1_General_CP1_CS_AS like ('%11%'), 1, 0)
from (values ('1'+char(0)+'1')) t(x)
Essentially, it seems that SQL Server with Latin1_General_CI_AS
simply ignores the NUL
character i.e. the first statement returns 1
and the second 0
.
I’ll dig a bit deeper to understand what is going on and how I can fix that, but I think it’s fine to change the collation for cycle detection.
I’m sorry for warming this up again, but the fix in https://hibernate.atlassian.net/browse/HHH-16945 seems to be insufficient for the problematic use case.
When using the test case we provided in https://hibernate.atlassian.net/browse/HHH-16465 , the following SQL is generated:
with AllParents (child_id, parent_id, groupTreeId, cycleMark, path) as (select gt1_0.CHILD_ID, gt1_0.PARENT_ID, gt1_0.id, 0, (char(0)+coalesce(cast(gt1_0.id as varchar(max)), char(0))+char(0)+char(0)) from GROUP_TREE_TABLE gt1_0 join GROUP_TABLE c1_0 on c1_0.id=gt1_0.CHILD_ID where c1_0.id=? union all select gt2_0.CHILD_ID, gt2_0.PARENT_ID, gt2_0.id, case when cte1_0.path like ('%'+char(0)+coalesce(cast(gt2_0.id as varchar(max)), char(0))+char(0)+char(0)+'%') then 1 else 0 end, (cte1_0.path+char(0)+coalesce(cast(gt2_0.id as varchar(max)), char(0))+char(0)+char(0)) from AllParents cte1_0 join GROUP_TREE_TABLE gt2_0 on cte1_0.parent_id=gt2_0.CHILD_ID where cte1_0.cycleMark=0) select child1_0.id, child1_0.NAME, parent2_0.id, parent2_0.NAME, ap1_0.groupTreeId, ap1_0.cycleMark from AllParents ap1_0 join GROUP_TABLE child1_0 on ap1_0.child_id=child1_0.id join GROUP_TABLE parent2_0 on ap1_0.parent_id=parent2_0.id
As you can see, the char(0) is casted to varchar(max) and thus the problem still occurs. If we run the query manually and switch it to varbinary(max) it works correctly.
We also added breakpoints in the CountFunction class you changed in the commit https://github.com/hibernate/hibernate-orm/commit/e73a1cdccb9de397a6b377f26e8b373883821580, but the CountFunction is never rendered for our query. We run the following query:
WITH AllParents AS( SELECT c child, p parent, gt.id groupTreeId FROM GroupTree gt INNER JOIN gt.parent p INNER JOIN gt.child c WHERE c = :start UNION ALL SELECT c2 child, p2 parent, gt2.id groupTreeId FROM AllParents cte JOIN GroupTree gt2 ON cte.parent = gt2.child INNER JOIN gt2.parent p2 INNER JOIN gt2.child c2 ) cycle groupTreeId set cycleMark SELECT ap.child, ap.parent, ap.groupTreeId, ap.cycleMark FROM AllParents ap
Can you please take another look? Thank you very much in advance and we would of course appreciate a higher priority since we receive incomplete data with it…