You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Fay Wang (JIRA)" <ji...@apache.org> on 2010/07/21 23:21:50 UTC
[jira] Created: (OPENJPA-1740) Type expression for entites using
Joined table strategy is not working properly
Type expression for entites using Joined table strategy is not working properly
-------------------------------------------------------------------------------
Key: OPENJPA-1740
URL: https://issues.apache.org/jira/browse/OPENJPA-1740
Project: OpenJPA
Issue Type: Bug
Components: jdbc, kernel
Affects Versions: 2.1.0
Reporter: Fay Wang
Assignee: Fay Wang
Fix For: 2.1.0
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OPENJPA-1740) Type expression for entites using
Joined table strategy is not working properly
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890923#action_12890923 ]
Fay Wang commented on OPENJPA-1740:
-----------------------------------
The patch will generate the correct SQL for the type expression:
JPQL: SELECT p FROM Person p where TYPE(p) <> Contractor
(1) SELECT t0.OID, t1.OID, t1.name, t2.description, t0.Dept_No, t0.FTEmpProp1
FROM WFulltimeEmployee t0
INNER JOIN WEmployee t2 ON t0.OID = t2.OID
INNER JOIN WPerson t1 ON t2.OID = t1.OID WHERE (1=1)
(2) SELECT t0.OID, t1.OID, t1.name, t2.description, t0.Dept_No, t0.PTEmpProp1
FROM WParttimeEmployee t0
INNER JOIN WEmployee t2 ON t0.OID = t2.OID
INNER JOIN WPerson t1 ON t2.OID = t1.OID WHERE (1=1)
JPQL: SELECT p FROM Person p where TYPE(p) = Contractor
(1) SELECT t0.OID, t1.OID, t1.name, t2.description, t0.ContractorProp1, t0.Dept_No
FROM WContractor t0
INNER JOIN WEmployee t2 ON t0.OID = t2.OID
INNER JOIN WPerson t1 ON t2.OID = t1.OID WHERE (1=1)
> Type expression for entites using Joined table strategy is not working properly
> -------------------------------------------------------------------------------
>
> Key: OPENJPA-1740
> URL: https://issues.apache.org/jira/browse/OPENJPA-1740
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc, kernel
> Affects Versions: 2.1.0
> Reporter: Fay Wang
> Assignee: Fay Wang
> Fix For: 2.1.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-1740) Type expression for entites using
Joined table strategy is not working properly
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang updated OPENJPA-1740:
------------------------------
Attachment: OPENJPA-1740.patch
> Type expression for entites using Joined table strategy is not working properly
> -------------------------------------------------------------------------------
>
> Key: OPENJPA-1740
> URL: https://issues.apache.org/jira/browse/OPENJPA-1740
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc, kernel
> Affects Versions: 2.1.0
> Reporter: Fay Wang
> Assignee: Fay Wang
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1740.patch
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OPENJPA-1740) Type expression for entites using
Joined table strategy is not working properly
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890907#action_12890907 ]
Fay Wang commented on OPENJPA-1740:
-----------------------------------
In a data model, where Employee inherits from Person. and Contractor/FulltimeEmployee/ParttimeEmployee inherit from Employee using Joined table strategy, the following JPQL generates wrong sqls:
JPQL: SELECT p FROM Person p where TYPE(p) = Contractor
Push-down SQL:
(1) SELECT t0.OID, t1.OID, t2.OID, t3.OID, t1.name
FROM WContractor t0
LEFT OUTER JOIN WEmployee t2 ON t0.OID = t2.OID
LEFT OUTER JOIN WPerson t1 ON t2.OID = t1.OID
LEFT OUTER JOIN WFulltimeEmployee t3 ON t2.OID = t3.OID
WHERE t2.OID IS NULL AND t0.OID IS NULL AND t3.OID IS NULL
(2) SELECT t0.OID, t2.OID, t1.OID, t3.OID, t2.name, t1.description
FROM WContractor t0
LEFT OUTER JOIN WEmployee t1 ON t0.OID = t1.OID
INNER JOIN WPerson t2 ON t1.OID = t2.OID
LEFT OUTER JOIN WFulltimeEmployee t3 ON t1.OID = t3.OID
WHERE t0.OID IS NULL AND t3.OID IS NULL
(3) SELECT t0.OID, t1.OID, t1.name, t2.description, t0.ContractorProp1, t0.Dept_No
FROM WContractor t0
INNER JOIN WEmployee t2 ON t0.OID = t2.OID
INNER JOIN WPerson t1 ON t2.OID = t1.OID
(4) SELECT t0.OID, t1.OID, t2.OID, t1.name, t3.description, t2.Dept_No, t2.FTEmpProp1
FROM WPerson t1
INNER JOIN WEmployee t3 ON t1.OID = t3.OID
INNER JOIN WFulltimeEmployee t2 ON t3.OID = t2.OID,
WContractor t0
> Type expression for entites using Joined table strategy is not working properly
> -------------------------------------------------------------------------------
>
> Key: OPENJPA-1740
> URL: https://issues.apache.org/jira/browse/OPENJPA-1740
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc, kernel
> Affects Versions: 2.1.0
> Reporter: Fay Wang
> Assignee: Fay Wang
> Fix For: 2.1.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (OPENJPA-1740) Type expression for entites using
Joined table strategy is not working properly
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang closed OPENJPA-1740.
-----------------------------
> Type expression for entites using Joined table strategy is not working properly
> -------------------------------------------------------------------------------
>
> Key: OPENJPA-1740
> URL: https://issues.apache.org/jira/browse/OPENJPA-1740
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc, kernel
> Affects Versions: 2.1.0
> Reporter: Fay Wang
> Assignee: Fay Wang
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1740.patch
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (OPENJPA-1740) Type expression for entites using
Joined table strategy is not working properly
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang resolved OPENJPA-1740.
-------------------------------
Resolution: Fixed
> Type expression for entites using Joined table strategy is not working properly
> -------------------------------------------------------------------------------
>
> Key: OPENJPA-1740
> URL: https://issues.apache.org/jira/browse/OPENJPA-1740
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc, kernel
> Affects Versions: 2.1.0
> Reporter: Fay Wang
> Assignee: Fay Wang
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1740.patch
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.