[hibernate-issues] [Hibernate-JIRA] Created: (HSEARCH-451) NativeQuery alias on column

Tomaž (JIRA) noreply at atlassian.com
Tue Feb 2 05:38:29 EST 2010


NativeQuery alias on column 
----------------------------

                 Key: HSEARCH-451
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-451
             Project: Hibernate Search
          Issue Type: Bug
          Components: query
    Affects Versions: 3.2.0.CR1
         Environment: OS: Win XP
Java: 1.6
Hibernate 3.2.5.ga
MySQL: 5.1
            Reporter: Tomaž
            Priority: Blocker


n a pure SQL I use alias on column(query is valid and server return true result) but Hibernate throw exception.
Also the problem is that the Hibernate retrieve wrong values for columns with the same name.

--------------------------------------------------
Example 1:

SQL = SELECT
        organizacije.id,
        koda.vrednost AS k,
        tip.vrednost AS t
     FROM
         organizacije
     LEFT JOIN
         sif_kodorg AS koda
             ON koda.id=organizacije.koda
     LEFT JOIN
         sif_tiporg AS tip
             ON tip.id=organizacije.tip_org
     WHERE
         organizacije.id=64

EntityManager.createNativeQuery(SQL) // error

error: org.hibernate.exception.SQLGrammarException: could not execute query

------------------------------------------

Example 2:
SQL = SELECT
        organizacije.id,
        koda.vrednost,
        tip.vrednost
    FROM
        organizacije
    LEFT JOIN
        sif_kodorg AS koda
            ON koda.id=organizacije.koda
    LEFT JOIN
        sif_tiporg AS tip
            ON tip.id=organizacije.tip_org
    WHERE
        organizacije.id=64
When retrieving result in a array I get the same value for both columns koda.vrednost, tip.vrednost
-----------------------------------

Why is here involved Hibernate Grammar if it's just a pure SQL, so is there any solutions how to retrieve values of columns with same name?

Regards, Tomaž

-- 
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