[hibernate-issues] [Hibernate-JIRA] Created: (EJB-397) native SQL queries in hibernate don't work when using aliases to differentiate columns that have the same name
Alex McCarrier (JIRA)
noreply at atlassian.com
Tue Oct 21 13:38:04 EDT 2008
native SQL queries in hibernate don't work when using aliases to differentiate columns that have the same name
--------------------------------------------------------------------------------------------------------------
Key: EJB-397
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-397
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.2.GA
Environment: jboss 4.2.2, mysql 5
Reporter: Alex McCarrier
Basically same as HHH-2094, if you do something like this:
select
oldForm.data as oldData
newForm.data as newData
from
form oldForm,
join form newForm on oldForm.replaced_by_id = newForm.id
then use entityManager.createNativeQuery(sql).getResultList()
it will end up with an error that says column named oldData does not exist. If you take out the aliases, then it will just return the first value for "data" for every column. If you run this through straight JDBC with the alias, it works as expected.
--
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