Bug 1207637
Summary: | [GSS](6.4.z) HHH-9758 - Broken SQL generated for dynamic batch fetching entities with a composite ID | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | Fedor Gavrilov <fgavrilo> | ||||||
Component: | Hibernate | Assignee: | Gail Badner <gbadner> | ||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Martin Simka <msimka> | ||||||
Severity: | unspecified | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 6.3.3 | CC: | bmaxwell, cdewolf, istudens, jmartisk, msimka, sfikes, smarlow | ||||||
Target Milestone: | CR1 | Keywords: | Reopened | ||||||
Target Release: | EAP 6.4.3 | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | |||||||||
: | 1232406 (view as bug list) | Environment: | |||||||
Last Closed: | 2017-01-17 10:36:35 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 1231259, 1232160, 1232406 | ||||||||
Attachments: |
|
Created attachment 1010378 [details]
Test case
I cannot reproduce any problem using Oracle.
I'm attaching a patch for test case that will add a test to the hibernate-core unit tests.
If you can update this test case to reproduce your issue, I'll take another look.
It's been almost a week. I will assume this is not a bug since I can't reproduce it. Re-open if you are able to reproduce. Thye say they sue org.hibernate.dialect.Oracle10gDialect with Oracle 11g. But is should it also be reproducible H2 with the slightly modified dialect: it's only this change public class CustomH2Dialect extends H2Dialect { @Override public boolean supportsRowValueConstructorSyntaxInInList() { return true; } } H2 does not support this syntax, so it is obvious that changing supportsRowValueConstructorSyntaxInInList() to return true will fail. Batch fetching entities that have a composite ID using BatchFetchStyle.DYNAMIC is broken. The generated SQL depends on whether Dialect.supportsRowValueConstructorSyntaxInInList() returns true or false, but it turns out that the SQL will be broken in both cases if the entity has a composite ID. Hibernate jira issue: https://hibernate.atlassian.net/browse/HHH-9758 I've pushed the fix for HHH-9758 to 4.2 branch: https://github.com/hibernate/hibernate-orm/commit/503fe45c467c1dca21ced0196c1b69f17b54891d Verified in EAP 6.4.3.CR1. Retroactively bulk-closing issues from released EAP 6.4 cummulative patches. Retroactively bulk-closing issues from released EAP 6.4 cummulative patches. |
Created attachment 1008974 [details] arquillian reproducer Description of problem: Version-Release number of selected component (if applicable): How reproducible: Originally appeared with Oracle dialect, however issue is reproducible with any dialect that returns true on supportsRowValueConstructorSyntaxInInList() call. The issue appears if batch style is set to DYNAMIC mode, but never if LEGACY. Steps to Reproduce: Please see attached reproducer Actual results: org.h2.jdbc.JdbcSQLException : Syntax error in SQL statement "SELECT B0_.IDPART1 AS IDPART1_1_0_, B0_.IDPART2 AS IDPART2_1_0_, B0_.OTHERPROPERTY AS OTHERPRO3_1_0_ FROM B B0_ WHERE (B0_.IDPART1,B0_.IDPART2) IN ((?,?,(?,?) "; expected "[, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ,, )"; SQL statement: select b0_.idPart1 as idPart1_1_0_, b0_.idPart2 as idPart2_1_0_, b0_.otherProperty as otherPro3_1_0_ from B b0_ where (b0_.idPart1,b0_.idPart2) in ((?,?,(?,?) [42001-168] [Proxied because : Original exception not deserilizable, ClassNotFoundException] or similar, depending on dialect used Expected results: legal {dynamic batch} SQL getting generated Additional info: