2013-07-12 64 views
0

查詢子屬性時,我面對空結果。子對象的JDO查詢集合

我的子對象如下圖所示自定義對象的列表:

家長

@PersistenceCapable 
@Inheritance(customStrategy = "complete-table") 
public class TimesheetRecordDaily{ 
... 
    @Persistent(embeddedElement = "true", serialized = "true", defaultFetchGroup="true") 
    @Element(embedded="true") 
    private List<TimesheetRecordDailyDetailDTO> timesheetRecordDailyDetails; 
... 
} 

兒童

@PersistenceCapable 
@EmbeddedOnly 
public class TimesheetRecordDailyDetailDTO{ 
... 
    @Persistent 
    private String projectName; 
... 
} 

查詢:

Query query = pm.newQuery(TimesheetRecordDaily.class); 
query.setFilter("this.timesheetRecordDailyDetails.contains(prd) && prd.projectName == 'MyProject'");    
query.declareVariables(TimesheetRecordDailyDetailDTO.class.getName() + " prd"); 
List results = (List)query.execute(); 

如果我改變查詢過濾器a (沒有查詢子屬性值,結果是返回

query.setFilter("this.timesheetRecordDailyDetails.contains(prd)"); 

任何幫助嗎?這是在GAE中運行的JDO查詢子屬性值的問題嗎?

注:我用GAE的版本是1.8.2

回答