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.

Attachments

1

Activity

Max Rydahl AndersenAugust 4, 2006 at 10:34 AM

Duplicated.

Creating new cases for the same thing doesn't make it easier for us to manage.

Max Rydahl AndersenAugust 4, 2006 at 10:33 AM

duplicate

Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Created August 4, 2006 at 10:24 AM
Updated December 8, 2007 at 10:47 PM
Resolved August 4, 2006 at 10:34 AM