Luca created Bug HHH-7515
Issue Type: Bug Bug
Affects Versions: 3.3.0.SP1
Assignee: Unassigned
Components: query-sql
Created: 09/Aug/12 8:53 AM
Description:

Using createSQLQuery with query like this "select column1, column2 ftom TESTTABLE where columnID=1234" cause an exception "java.lang.StringIndexOutOfBoundsException: String index out of range: 0" if "column1" or "column2" contains has a value '' (void string) so it no null but it contains no chars.

The get method CharacterType.get(CharacterType.java:52) is calling java.lang.String.charAt(0) on a String instance with length zero.

Steck Trace:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:687)
at org.hibernate.type.CharacterType.get(CharacterType.java:52)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:210)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:497)
at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:443)
at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:340)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:629)
at org.hibernate.loader.Loader.doQuery(Loader.java:724)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)

Environment: Sun JDK 1.6.0
MySQL 5.5
Project: Hibernate ORM
Labels: query SQL
Priority: Critical Critical
Reporter: Luca
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira