@NamedEntityGraphs({
@NamedEntityGraph(name = CITY_BASIC, attributeNodes = {
@NamedAttributeNode("state"),
@NamedAttributeNode("country")
}),
@NamedEntityGraph(name = CITY_DETAILS, attributeNodes = {
@NamedAttributeNode("state"),
@NamedAttributeNode("country"),
@NamedAttributeNode(value = "suburbs", subgraph = "basic")
},
subgraphs = @NamedSubgraph(name = CITY_BASIC, attributeNodes = {
@NamedAttributeNode("state"),
@NamedAttributeNode("country")
}))
})
public class City {
private String name;
private State state;
private Set<City> suburbs;
}
另一个具有City对象的类,例如
public class Address {
private String street;
private City city;
}
如果我希望Address
的实体图使用子图中的现有CITY_BASIC
或CITY_DETAILS
实体图,该怎么办?