Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3305

Duplicated fields on using ORDER BY

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • No Release
    • JBossAS-4.0.4.GA
    • CMP service
    • None

      I have found when in query exists ORDER BY and specified strategy in generated sql selected fields are duplicated.

      with <strategy>on-find</strategy>

      For instance, in next query it's description

      2006-06-10 22:37:41,078 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.HolidayEJB#findAll Executing SQL: SELECT t0_o.holiday_id, t0_o.date_when, t0_o.description, t0_o.holiday_group_id, t0_o.description FROM holidays t0_o ORDER BY t0_o.description DESC

      In next 2 fields (name and project_id)

      2006-06-10 22:46:35,734 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.ComponentEJB#ejbSelectGeneric DYNAMIC-QL: SELECT OBJECT($components) FROM components AS $components ORDER BY $components.name ASC, $components.projectId ASC OFFSET ?1 LIMIT 2
      2006-06-10 22:46:35,734 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.ComponentEJB#ejbSelectGeneric Executing SQL: SELECT t0_$components.component_id, t0_$components.project_id, t0_$components.name, t0_$components.paid, t0_$components.manager_user_id, t0_$components.name, t0_$components.project_id FROM components t0_$components ORDER BY t0_$components.name ASC, t0_$components.project_id ASC

      with <strategy>on-load</strategy>
      Performed 2 queries, but first query very strange – there not only id but also fields specified in ORDER BY

      2006-06-10 23:09:21,921 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.ComponentEJB#ejbSelectGeneric DYNAMIC-QL: SELECT OBJECT($components) FROM components AS $components ORDER BY $components.name ASC, $components.projectId ASC OFFSET ?1 LIMIT ?2
      2006-06-10 23:09:21,937 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.ComponentEJB#ejbSelectGeneric Executing SQL: SELECT t0_$components.component_id, t0_$components.name, t0_$components.project_id FROM components t0_$components ORDER BY t0_$components.name ASC, t0_$components.project_id ASC
      2006-06-10 23:09:21,937 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.ComponentEJB#ejbSelectGeneric Query offset=0, limit=8
      2006-06-10 23:09:21,953 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ComponentEJB] Executing SQL: SELECT component_id, project_id, name, paid, manager_user_id FROM components WHERE (component_id=?) OR (component_id=?) OR (component_id=?) OR
      (component_id=?) OR (component_id=?) OR (component_id=?) OR (component_id=?) OR (component_id=?)

              olubyans@redhat.com Alexey Loubyansky
              vmorarian Vitaliy Morarian (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: