I have a relation (in Derby 10.5.3.0 ) like Order --> OrderLine.
In Order is
@Basic(fetch= FetchType.EAGER )
public Collection<OrderLines> getOrderLinesCollection() {
if ( orderLinesCollection== null )
orderLinesCollection= new ArrayList();
return orderLinesCollection;
}
The problem is
a) If new OrderLine is added to db separately like.
em.persist(orderLine)
em.refresh(orderLine)
and then Order is fetched like
SELECT o FROM Order o WHERE o.id = :orderId "
the new ordeline is not in orderlines collection.
WHY ?
=> How the new orderline can be refreshed in EntityManager ?
b) If new OrderLine is added thru Order like
order.getOrderLinesCollection.add(currentWire);
getFacade().edit(order);
Now the query presented up finds the new orderline just
inserted to database.
[Message sent by forum member 'steelyx2' (sakari.isoniemi_at_tieto.com)]
http://forums.java.net/jive/thread.jspa?messageID=389604