[Hibernate-JIRA] Created: (HHH-2546) fetch="select" doesn't work when there are no mapped columns in joined except <key
by Derar Bakr (JIRA)
fetch="select" doesn't work when there are no mapped columns in joined except <key
----------------------------------------------------------------------------------
Key: HHH-2546
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2546
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.3
Environment: Windows XP Pro
Reporter: Derar Bakr
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.String.substring(String.java:1768)
at java.lang.String.substring(String.java:1735)
at org.hibernate.persister.entity.AbstractEntityPersister.renderSelect(AbstractEntityPersister.java:2899)
at org.hibernate.persister.entity.SingleTableEntityPersister.generateSequentialSelect(SingleTableEntityPersister.java:647)
at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:696)
....
Everything is very simple.
There is stupid code in SelectFragment class, method toFragmentString, line 94. String that is being created there, contains list of fields, like a "f1, f2, f3, ..., fn".
", " is being added in every iteration, without check for it is first iteration.
And in class AbstractEntityPersister., method renderSelect, line 2899, where that method is called, this first ", " is deleted using substring(2). So no check for empty string.
I suggest to add check :)))
I just create dynamic mappings programmatically, so create empty join subclass mappings - and in created table there are no fields by default except foreing key.
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 1 month