Announcement Announcement Module
Collapse
No announcement yet.
HibernateTemplate findByNamedQuery : Native SQL Query Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HibernateTemplate findByNamedQuery : Native SQL Query

    I am using hibernateTemplate findByNamedQuery method to load the object.
    This object has duplicate records .

    Is their a way that i can load the object without duplicate records.???

    Here is my NamedQuery which loads the Buildings object
    Code:
    <query name="findBuildings">
            <![CDATA[
                select DISTINCT buildings from com.XXX.model.Building buildings order by buildings.building
            ]]>
        </query>
    The query works fine but it populates the dropdown with duplicate records
    So i tried Native SQL query
    Code:
    <sql-query name="findBuildings"> 
         <return alias="obldg" class="com.boeing.nmt.nams.model.NamsBuilding"/>        
              SELECT  bldg.building AS {obldg.building}
              FROM Nams_Building bldg            
        </sql-query>
    This query results in Invalid Column name

    Any pointers/suggestions on how to avoid loading Objects without duplicate records will be highly appreciated
Working...
X