[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2964) missing column name due to IndexNode.resolve calling queryableCollection.getIndexColumnNames()
Gail Badner (JIRA)
noreply at atlassian.com
Mon Nov 26 19:18:56 EST 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28962 ]
Gail Badner commented on HHH-2964:
----------------------------------
Please attach a runnable Java test case so it can be added to the unit tests.
> missing column name due to IndexNode.resolve calling queryableCollection.getIndexColumnNames()
> ----------------------------------------------------------------------------------------------
>
> Key: HHH-2964
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2964
> Project: Hibernate3
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.4.sp1, 3.2.5
> Environment: hibernate-core 3.2.5, mysql 5
> Reporter: Kay Schubert
> Attachments: IndexNode.patch
>
>
> Declared entities:
> @Entity
> class Book {
> @Id
> long id;
> @OneToMany(mappedBy = "id.book")
> @MapKey(name = "id.stationName")
> private Map<String, StationBooksCounter> stationBooksCounter;
> }
> @Embeddable
> class StationBooksCounterPk {
> String stationName;
> @ManyToOne(optional = false)
> Book book;
> }
> @Entity
> class StationBooksCounter {
> @EmbeddedId
> StationBooksCounterPk id;
> int count;
> }
> HQL: "from Book b where b.stationBooksCounter['key'].count > '0'" results in that
> SQL: "select ... from Book book0_ where exists ( select 1 from StationBooksCounter stationboo3_ where books0_.id=stationboo3_.book_id and stationboo3_.null = 'key' and and stationboo3_.count>'0')"
> (statements text have been deducted from analogous queries in actual application - I didn't actually compile that simplified test case, since I'm quite sure what the problem is)
> The "stationboo3_.null" is caused by IndexNode.resolve calling queryableCollection.getIndexColumnNames() to resolve the index column name. Here queryableCollection is an org.hibernate.persister.collection.AbstractCollectionPersister, and getIndexColumnNames() returns the String[] indexColumnNames, containing only one null element. I changed that to AbstractCollectionPersister.getIndexColumnNames(String tableAlias). It uses indexColumnNames as well as indexFormulaTemplates to build the SQL fragment.
--
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
More information about the hibernate-issues
mailing list