public void populate() throws ParseException {
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Shop s = new Shop();
Order order;
Item item;
Producer p;
s.setId(1);
s.setName("eBay.com");
s.setOrders(new HashSet<Order>());
for (int i = 1; i <= N_ORDERS; i++) {
order = new Order();
order.setId(i);
order.setDate(df.parse(ORDER_DATES[i % ORDER_DATES.length]));
order.setFilled(i % 2 == 0 ? true : false);
order.setShop(s);
order.setItems(new HashSet<Item>());
s.getOrders().add(order);
for (int j = 1; j <= N_ITEMS_PER_ORDER; j++) {
item = new Item();
item.setOrder(order);
order.getItems().add(item);
p = new Producer();
p.setName("filler");
p.setItem(item);
item.setProduct(p);
}
}
em.persist(s);
Person person = new Person("Test Result Shape");
em.persist(person);