@Test public void testFindByIdWithLines() { Long id = createOrder(); System.out.println("findByIdWithLines(" + id + "):"); Order order = orderDao.findByIdWithLines(id); System.out.println("getLines().size():"); order.getLines().size(); }
@Test public void testFindByIdWithLinesAndArticles() { Long id = createOrder(); System.out.println("findByIdWithLinesAndArticles(" + id + "):"); Order order = orderDao.findByIdWithLinesAndArticles(id); for (Line line : order.getLines()) { System.out.println(line.getArticles().size()); } }
private Long createOrder() { System.out.println("createOrder():"); Order order = new Order(); order.getLines().add(new Line()); order.getLines().add(new Line()); Line line = new Line(); line.getArticles().add(new Article()); line.getArticles().add(new Article()); order.getLines().add(line); return (Long) orderDao.save(order); }