From: Thomas A. (JIRA) <no...@at...> - 2006-08-04 08:25:13
|
Expression.in on component object gives parameters til SQL in wrong order. -------------------------------------------------------------------------- Key: HHH-1972 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1972 Project: Hibernate3 Type: Bug Components: query-criteria Versions: 3.1.2 Environment: Development in IntellIJ IDEA 4.5.3 Database:Oracle 10g Enteprise Edition release 10.1.0.2.0 Reporter: Thomas Andersen Attachments: HibernateBug.zip 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. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |