Description
Christian Klat created an issue — 9th December 2008, 5:24:46:
When excuting a subquery using the DetachedCriteria, the query generated looks fine.
But the sub-query select has aliases on the columns (as y0_) and sybase doesn't allow that in a subqueries.Example:
SELECT this*.AuditLineId as AuditLin1_0_3*, FROM AuditLine this_ inner join CategoryValue categoryva1* on this_.AuditLineId=categoryva1*.AuditLineId WHERE categoryva1*.CategoryId in ( SELECT this_0_.CategoryValueId <i>[b]as y0*[/b][/i] ==========> Forbidden in Sybase FROM CategoryValue this*0* inner join Category category1* on this_0_.Category=category1*.CategoryId WHERE category1_.Name = 'Tax')
Fabio Maulo added a comment — 15th December 2008, 20:02:31:
And what you think we can do with it ?
Christian Klat added a comment — 16th December 2008, 1:39:15:
Well I wasn't familiar with NHibernate Source Code. I'm willing to have a look... I already downloaded the Source Code to start looking.
If you could give me some tips as to where to start looking for subqueries generation:The aliases in these subqueries SELECTs are useless as they are used to do Projections right ?
Are there cases where you need theses aliases on subselects ? If not, I would suggest having a special treatment for the Sybase Dialect in the Query Generation Process.Again I don't know where to start digging. But I'm willing to as soon as I have time to do so.
BTW this bugs is also linked to Hibernate 3.2.4.sp1:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3511
ayenderahien added a comment — 15th May 2009, 21:57:06:
The fix wouldn't be a simple one, I am afraid.
Basically, you would need to go over all the projection classes and make them aware of that.
If you want to add a patch for that, you need to look at all classes implementing IProjection