Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projection and join fetch in hql leads to duplicated column aliases #2092

Closed
bahusoid opened this issue Mar 28, 2019 · 0 comments · Fixed by #2551
Closed

Projection and join fetch in hql leads to duplicated column aliases #2092

bahusoid opened this issue Mar 28, 2019 · 0 comments · Fixed by #2551

Comments

@bahusoid
Copy link
Member

bahusoid commented Mar 28, 2019

var results =  session
.CreateQuery("select o.Employee.FirstName, o from Order o join fetch o.Customer")
.SetMaxResults(1)
.UniqueResult<object[]>();

The query above leads to duplicated column aliases for fetched Customer ID:

SELECT employee2_.FirstName AS col_0_0_
	,order0_.OrderId AS col_1_0_
	,customer1_.CustomerId AS customerid1_0_1_ -- <-HERE
	,order0_.OrderId AS orderid1_3_0_
	,customer1_.CustomerId AS customerid1_0_1_ -- <-AND HERE
...

And that doesn't work on Oracle (for queries with paging) and SQL Server CE, SQL Anywhere.

Related issue:
https://nhibernate.jira.com/browse/NH-1773

bahusoid added a commit to maca88/nhibernate-core that referenced this issue Oct 27, 2022
@hazzik hazzik added this to the 5.4 milestone Oct 30, 2022
hazzik pushed a commit that referenced this issue Oct 31, 2022
* Add support for joining a subquery in hql
* Enable tests and fix #2092

Co-authored-by: Roman Artiukhin <bahusdrive@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants