cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcin Skladaniec (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAY-1178) inheritance builds a wrong query when using entity qualifier
Date Wed, 04 Feb 2009 03:49:46 GMT
inheritance builds a wrong query when using entity qualifier
------------------------------------------------------------

                 Key: CAY-1178
                 URL: https://issues.apache.org/cayenne/browse/CAY-1178
             Project: Cayenne
          Issue Type: Bug
          Components: Cayenne Core Library
    Affects Versions: 3.0M5
         Environment: svn build 740089, both ROP and classic cayenne
            Reporter: Marcin Skladaniec


Model defined as follows:

Product is a super class, it has a qualifier: (isDeleted = null) or (isDeleted = 0)
ArticleProduct inherits from Product, its qualifier is: type = 1
MembershipProduct inherits from Product, its qualifier is: type = 2
VoucherProduct inherits from Product, its qualifier is: type = 3
(type is the attribute which defines the different subclasses)

Now executing query:
new SelectQuery(Product.class) 

causes following SQL to be generated:
SELECT t0.id, ....... FROM Product t0 WHERE (t0.isDeleted IS NULL) OR (t0.isDeleted = ?) OR
(t0.type = ?) OR (t0.type = ?) OR (t0.type = ?) [bind: 1->isDeleted:0, 2->type:1, 3->type:2,
4->type:3]

as you can see the qualifiers are OR'ed between superclass and subclass, they should be AND'ed.
Alternatively the superclass entity qualifier could be ignored at all forcing repetition of
the qualifier in the subclass.




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


Mime
View raw message