以下を含む親子エンティティモデルがあります。
@PersistenceCapable(detachable = "true")
public class Area implements Serializable {
@PrimaryKey
private String name;
@Persistent(mappedBy = "area")
@Element(dependent = "true")
private List<Category> categories;
}
@PersistenceCapable(detachable = "true")
public class Category implements Serializable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
private String key;
@Persistent
private Area area;
}
すべてのエリアとそのカテゴリを取得する場合、結果をカテゴリ名で並べ替えることができますか?
JDO Query には setOrdering メソッドがあることがわかりましたが、それは子エンティティではなく、クエリを実行するエンティティのプロパティに適用されているようです。
現在、TreeMap を使用してソートを行っていますが、そのためには JDO/GSQL を使用する方がはるかに優れています。