I am about to use new features from JPA 2.1. One of them is named entity graph.
If my entity has two graphs, can I use these in a query?
EntityGraph graph1 = this.em.getEntityGraph("graph.Order.items");
EntityGraph graph2 = this.em.getEntityGraph("graph.Order.address");
For exampe, like below
Map hints = new HashMap();
hints.put("javax.persistence.fetchgraph", graph1);
hints.put("javax.persistence.fetchgraph", graph2);
Order order = this.em.find(Order.class, orderId, hints);
or
entityManager.setHint("javax.persistence.fetchgraph", graph1);
entityManager.setHint("javax.persistence.fetchgraph", graph2);
The reason is that I other queries may need only one among defined graphs.