Bug 1207637 - [GSS](6.4.z) HHH-9758 - Broken SQL generated for dynamic batch fetching entities with a composite ID
Summary: [GSS](6.4.z) HHH-9758 - Broken SQL generated for dynamic batch fetching entit...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.3.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.4.3
Assignee: Gail Badner
QA Contact: Martin Simka
URL:
Whiteboard:
Depends On:
Blocks: 1231259 1232160 1232406
TreeView+ depends on / blocked
 
Reported: 2015-03-31 11:51 UTC by Fedor Gavrilov
Modified: 2019-07-11 08:52 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
: 1232406 (view as bug list)
Environment:
Last Closed: 2017-01-17 10:36:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
arquillian reproducer (5.92 KB, application/x-gzip)
2015-03-31 11:51 UTC, Fedor Gavrilov
no flags Details
Test case (9.40 KB, patch)
2015-04-02 23:51 UTC, Gail Badner
no flags Details | Diff

Description Fedor Gavrilov 2015-03-31 11:51:34 UTC
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:

Comment 1 Gail Badner 2015-04-02 23:51:37 UTC
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.

Comment 2 Gail Badner 2015-04-08 20:01:57 UTC
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.

Comment 4 Fedor Gavrilov 2015-04-15 07:23:30 UTC
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;
    }
}

Comment 5 Gail Badner 2015-04-15 18:21:42 UTC
H2 does not support this syntax, so it is obvious that changing supportsRowValueConstructorSyntaxInInList() to return true will fail.

Comment 12 Gail Badner 2015-04-29 22:32:36 UTC
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

Comment 13 Gail Badner 2015-04-30 00:22:46 UTC
I've pushed the fix for HHH-9758 to 4.2 branch: https://github.com/hibernate/hibernate-orm/commit/503fe45c467c1dca21ced0196c1b69f17b54891d

Comment 21 Jan Martiska 2015-07-29 13:17:16 UTC
Verified in EAP 6.4.3.CR1.

Comment 22 Petr Penicka 2017-01-17 10:36:35 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 23 Petr Penicka 2017-01-17 10:37:25 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.


Note You need to log in before you can comment on or make changes to this bug.