JDO查询帮助(按配料查找食谱)

| 我需要有关JDO查询的帮助。 我有以下实体: 食谱:
@PersistenceCapable
class Recipe{

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long key;

    ...

    @Persistent(mappedBy = \"recipe\")
    private List<RecipeIngredient> ingredients
}
配方成分:
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable=\"true\")
class RecipeIngredient implements Serializable {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    Integer amount

    @Persistent
    Key unit

    @Persistent
    Key ingredient

    @Persistent
    Recipe recipe
成分:
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable=\"true\")
class Ingredient implements Serializable {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    String name
一个配方可以有几个配方成分,其中包含实际成分,成分数量和单位。 我想按仅包含给定成分而不包含更多成分的成分获取所有食谱。 目前,我这样做: 通过成分名称获取所有成分对象 通过成分键获取所有配方成分对象 按食谱获取所有食谱 检查食谱中的所有食谱成分是否都在之前的食谱成分列表中 如果是这样,则将配方添加到输出列表 我可以通过查询吗?也许与拥有类似的东西?     
已邀请:
尝试类似... 从配方r中选择r         其中Ingredients.contains(ri)&&(ri.ingredient.name.matches(:searchTxt)) 还可以看一下:http://www.datanucleus.org/servlet/forum/listthreads?forum=9 我不使用Google App Engine,但确实大量使用DataNucleus,并且我相信DataNucleus是App Engine使用的JDO的实现。 让我知道它在App Engine上的工作原理,因为我一直在我的应用程序中做同样的事情。     

要回复问题请先登录注册