This content has been marked as final.
Show 2 replies
-
1. Re: @NamedSubgraph not working?
ctomc Feb 5, 2014 11:12 AM (in response to th.janssen)What exact version of WildFly?
-
Hi,
I am experimenting with the new entity graphs. I have 3 entities Order - OrderItem - Product and I want to define an entity graph for the Order that loads the OrderItem and Product (see below).
The entity graph fetch.Order.items works for the OrderItem but not for the Product. Has anyone a working example for the usage of NamedSubgraph or can tell me what is wrong?
Thanks!
Thorben
@Entity
@Table(name = "purchase_order")
@NamedEntityGraph(name = "fetch.Order.items",
attributeNodes = @NamedAttributeNode(value = "items", subgraph = "items"),
subgraphs = @NamedSubgraph(name = "items", attributeNodes = @NamedAttributeNode("product")))
public class Order implements Serializable {
@OneToMany(mappedBy = "order", fetch = FetchType.LAZY)
private Set<OrderItem> items = new HashSet<OrderItem>();
....
@Entity
public class OrderItem implements Serializable
{
@ManyToOne(fetch = FetchType.LAZY)
private Product product;
....
What exact version of WildFly?