From: Viatcheslav (JIRA) <no...@at...> - 2006-05-11 11:23:23
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-708?page=comments#action_23079 ] Viatcheslav commented on HHH-708: --------------------------------- Agree, have this issue too. As quick shot the loop order in org.hibernate.criterion.InExpression::getTypedValues is wrong instead of for ( int i=0; i<types.length; i++ ) { for ( int j=0; j<values.length; j++ ) { Object subval = values[j]==null ? null : actype.getPropertyValues( values[j], EntityMode.POJO )[i]; list.add( new TypedValue( types[i], subval, EntityMode.POJO ) ); } } it should be for ( int j=0; j<values.length; j++ ) { for ( int i=0; i<types.length; i++ ) { Object subval = values[j]==null ? null : actype.getPropertyValues( values[j], EntityMode.POJO )[i]; list.add( new TypedValue( types[i], subval, EntityMode.POJO ) ); } } After change have worked for me. This bug is marked as closed, maybe new one should be opened or this reopened, otherwise I'm afraid the developers will not see the issue. > Restrictions.in could not be used properly on composite-ids > ----------------------------------------------------------- > > Key: HHH-708 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-708 > Project: Hibernate3 > Type: Bug > Components: core > Versions: 3.0.5 > Environment: Oracle 9i, org.hibernate.criterion.InExpression > Reporter: Holger Bartnick > Fix For: 3.1 beta 1 > > > Restrictions.in could not be used properly on composite-ids > for a composite-id with the attributes key and station > the resulting sql is like: > [where key in (?,?...) and station in (?,?...)] > it should result in an sql like: > [where (key, station) in ((?,?),(?,?)...)] > otherwise the result would be a scalar product > example: > key station > 1 1 > 2 1 > 2 2 > 3 2 > [where key in (1,2,3) and station in (1,2)] > would return all values > [where (key, station) in ((1,1),(2,1),(3,2))] > would omit the record (2,2) -- 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 |