-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @NamedSubgraph not working
PostPosted: Fri Jan 17, 2014 5:44 pm 
Newbie

Joined: Fri Jan 17, 2014 5:34 pm
Posts: 1
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 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

Code:
@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>();


Code:
@Entity
public class OrderItem implements Serializable
{
   @ManyToOne(fetch = FetchType.LAZY)
   private Product product;


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.