Issue Details (XML | Word | Printable)

Key: SPR-1598
Type: Bug Bug
Status: Resolved Resolved
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: Ben Hale
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Framework

HibernateTemplate does not substitute objects correctly using find(String, Object)

Created: 07/Jan/06 03:22 PM   Updated: 09/Jan/06 06:02 AM
Component/s: SpringCORE
Affects Version/s: 2.0 M1
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Hibernate 3.1

Virtual Machine: Sun JVM - 1.5
Platform: Standalone


 Description  « Hide
When running a query using the HibernateTemplate().find(String, Object) method, I get an exception thrown out from Hibernate that says: "java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based!". I've tracked it down to HibernateTemplate.java line 802. Clearly you're starting insertion at 0, and if hibernate is correct on that fact this should be changed.

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Juergen Hoeller added a comment - 07/Jan/06 05:57 PM
Actually, the Hibernate docs specify that positional parameters for queries start from 0 - at the Query API level, that is. That has always been that way, and we've been working with this for years now. Hibernate must internally translate this to "ordinal parameters" which seem to be 1-based, but that should not affect the user API level at all.

So could you please specify more details for your scenario? What exactly are you passing in for which HQL query string?

Juergen

Ben Hale added a comment - 08/Jan/06 01:49 PM
I did a little more work trying to track down exactly what the problem was and it turns out the problem was Hibernate's bad error messages. I had switched the id and version types to long from int and never updated the mapping files. So that's what the error actually was, not what it was claiming. A fix to that and now everything works just fine. You can go ahead and close this error ticket and I apologize for not catching the actual problem before opening it. Thanks.

Juergen Hoeller added a comment - 09/Jan/06 06:02 AM
No problem :-)

Juergen