Bug 1111706 - [GSS](6.3.0) NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias
Summary: [GSS](6.3.0) NonUniqueDiscoveredSqlAliasException: Encountered a duplicated s...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: EAP 6.3.0
Assignee: Gail Badner
QA Contact: Martin Simka
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-20 19:03 UTC by Stephen Fikes
Modified: 2018-12-05 18:55 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-08-11 19:07:03 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Maven based test (3.52 KB, application/x-gzip)
2014-06-20 19:03 UTC, Stephen Fikes
no flags Details

Description Stephen Fikes 2014-06-20 19:03:43 UTC
Created attachment 910870 [details]
Maven based test

Description of problem:
For any simple entity (e.g. Event) a native SQL query which specifies a column multiple times (e.g. "select e.id, e.title, e.id from Event e") fails in Hibernate 4:

org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias [id] during auto-discovery of a native-sql query

Version-Release number of selected component (if applicable):
Hibernate 4

How reproducible:
Consistently

Steps to Reproduce:
For a simple entity, execute a native SQL query specifying one column (e.g. 'id') multiple times
	List results = session.createSQLQuery(
		"select e.id, e.title, e.id from Event e").list();

Actual results:
org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias [id] during auto-discovery of a native-sql query
	at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:630)
	at org.hibernate.loader.Loader.getResultSet(Loader.java:2039)
	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1832)
	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1811)
	at org.hibernate.loader.Loader.doQuery(Loader.java:899)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
	at org.hibernate.loader.Loader.doList(Loader.java:2516)
	at org.hibernate.loader.Loader.doList(Loader.java:2502)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332)
	at org.hibernate.loader.Loader.list(Loader.java:2327)
	at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:338)
	at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1826)
	at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:231)
	at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:157)
	...

Expected results:
The exception is not expected.

Additional info:
- The same query works as late as in Hibernate 3.3.2.GA.
- Modifying the query to use explicit column aliases works around the issue:
	"select e.id as eid1, e.title, e.id as eid2 from Event e"

Comment 2 Gail Badner 2014-06-23 20:06:11 UTC
This is an expected failure due to HHH-5992. The workaround is the appropriate way to deal with this.


Note You need to log in before you can comment on or make changes to this bug.