[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-397?page=co...
]
Caine Lai commented on EJB-397:
-------------------------------
Agreed. We are having the same issue with native queries in hibernate. We want to be
able to run reports off our database using native sql without having to provide mappings.
As HHH-2094 stated, we shouldn't be required to provide mappings for native sql if we
just want a simple array structure returned.
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira