Expression.in on component object gives parameters til SQL in wrong order.

Description

I'm using an Expression.in on a component class with two attributes (one Long and one String). When executing the code I an empty list.

When using the generated SQL in DBVisualizer adding the variables it returns the expectet list.

Debug log level and reveals (in sample project:
Parameters are bound in the wrong order:
Paramters are bound
... where (this_.ejerlavskode, this_.matrikelnr) in ((9999, 9999), (01, 03))

should be 9999, 01, 9999, 03 according to
... where (this_.ejerlavskode, this_.matrikelnr) in ((9999, 01), (9999, 03))

Parameter pairs are by class Matrikelbetegnelse(ejerlavskode=9999, matrikenr=01)

I have made a small sample project:

The project contains three classes BugTest , Main and Component.

I have included a sql.ddl file with the create table, inserts of testdata, etc.

You have to modify the "hibernate.test.xml" to include your URL, USER, PASSWORD and SCHEMA.

The BugTest main method contains two methods:

  • one 'testExpectedResult()' for the expectet result using Expression.sql(...) which works, but demands more code.
    SQL: from tan.main_table this_ where (this_.longValue, this_.stringValue) in ((?,?), (?,?))
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '9998' to parameter: 1
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '02' to parameter: 2
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '9996' to parameter: 3
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '04' to parameter: 4

  • two 'testBugResult()' for the incorrect result using Expression.in(...) which does not work, but is more elegant.
    SQL: from tan.main_table this_ where (this_.longValue, this_.stringValue) in ((?, ?), (?, ?))
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '9998' to parameter: 1
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '9996' to parameter: 2
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '02' to parameter: 3
    DEBUG [...type.NullableType.nullSafeSet(NullableType.java:79)] binding '04' to parameter: 4

The generated SQL is the same using either statement.

Best regards,
Thomas

P.S. I reported this problem on june 12'th (key=HHH-1832), but haven't heard anything.

Environment

Development in IntellIJ IDEA 4.5.3
Database:Oracle 10g Enteprise Edition release 10.1.0.2.0

Attachments

Assignee

Unassigned

Reporter

User known

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure