You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Pinaki Poddar (JIRA)" <ji...@apache.org> on 2008/01/14 19:08:34 UTC

[jira] Created: (OPENJPA-485) Generates syntactically wrong SQL query for JPQL that uses ORDER BY on TABLE_PER_CLASS inheritance hierarchy

Generates syntactically wrong SQL query for JPQL that uses ORDER BY on TABLE_PER_CLASS inheritance hierarchy
------------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-485
                 URL: https://issues.apache.org/jira/browse/OPENJPA-485
             Project: OpenJPA
          Issue Type: Bug
          Components: query
            Reporter: Pinaki Poddar


Symptom:
Generates wrong SQL query 
   "SELECT t1.id, t1.name, t0.name FROM  ORDER BY t0.name ASC"
for a JPQL Query 
   "SELECT p FROM Base p ORDER BY p.name"

Condition:
    where Base class uses TABLE_PER_CLASS inheritance strategy and has one or more known subclasses.

Cause:
   The routine that fails to handle aliasing and leaves the table in FROM clause empty is JDBCStoreManager.selectBaseMappings() line 1028-1031. 


Note:
  Queries that do not use ORDER BY on the same class hierarchy such as
  "SELECT p FROM Base [WHERE <some condition>]" 
  works.



 

   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-485) Generates syntactically wrong SQL query for JPQL that uses ORDER BY on TABLE_PER_CLASS inheritance hierarchy

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar resolved OPENJPA-485.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.0
                   1.2.0

Fixed on trunk with revision 681781.

Merged to 1.2.0 with revision 681788.

The change has unintended but positive impact on 
a) previously failed test  on org\apache\openjpa\persistence\managedinterface\TestManagedInterfaces.java (OPENJPA-481)
b) it now supports traversal through a collection valued path expression. 
     SELECT s FROM Student s WHERE s.departments.name = 'XYZ' 
     will return Students whose any of the departments in 'XYZ'
     This is not kosher as per JPA Spec but apparently convenient for the user.
     See org\apache\openjpa\persistence\jpql\clauses\TestEJBClauses.java 


> Generates syntactically wrong SQL query for JPQL that uses ORDER BY on TABLE_PER_CLASS inheritance hierarchy
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-485
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-485
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>            Reporter: Pinaki Poddar
>            Assignee: Pinaki Poddar
>             Fix For: 1.2.0, 1.3.0
>
>
> Symptom:
> Generates wrong SQL query 
>    "SELECT t1.id, t1.name, t0.name FROM  ORDER BY t0.name ASC"
> for a JPQL Query 
>    "SELECT p FROM Base p ORDER BY p.name"
> Condition:
>     where Base class uses TABLE_PER_CLASS inheritance strategy and has one or more known subclasses.
> Cause:
>    The routine that fails to handle aliasing and leaves the table in FROM clause empty is JDBCStoreManager.selectBaseMappings() line 1028-1031. 
> Note:
>   Queries that do not use ORDER BY on the same class hierarchy such as
>   "SELECT p FROM Base [WHERE <some condition>]" 
>   works.
>  
>    

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OPENJPA-485) Generates syntactically wrong SQL query for JPQL that uses ORDER BY on TABLE_PER_CLASS inheritance hierarchy

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar reassigned OPENJPA-485:
-------------------------------------

    Assignee: Pinaki Poddar

> Generates syntactically wrong SQL query for JPQL that uses ORDER BY on TABLE_PER_CLASS inheritance hierarchy
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-485
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-485
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>            Reporter: Pinaki Poddar
>            Assignee: Pinaki Poddar
>
> Symptom:
> Generates wrong SQL query 
>    "SELECT t1.id, t1.name, t0.name FROM  ORDER BY t0.name ASC"
> for a JPQL Query 
>    "SELECT p FROM Base p ORDER BY p.name"
> Condition:
>     where Base class uses TABLE_PER_CLASS inheritance strategy and has one or more known subclasses.
> Cause:
>    The routine that fails to handle aliasing and leaves the table in FROM clause empty is JDBCStoreManager.selectBaseMappings() line 1028-1031. 
> Note:
>   Queries that do not use ORDER BY on the same class hierarchy such as
>   "SELECT p FROM Base [WHERE <some condition>]" 
>   works.
>  
>    

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.