@Test
public void testListWithEntries() throws Exception {
try {
userTransaction.begin();
TodoList todoList = new TodoList("Testlist");
TodoEntry te1 = creteEntry("#1", "d:#1");
todoList.getEntries().add(te1);
TodoList create = crudService.create(todoList);
crudService.flush();
List<TodoList> all = crudService.findByNamedQuery(TodoList.ALL);
assertEquals(1, all.size());
assertEquals(1, all.iterator().next().getEntries().size());
Long id = create.getId();
crudService.flush();
TodoList find = crudService.find(TodoList.class, id);
TodoEntry te2 = creteEntry("#2", "d:#2");
find.getEntries().add(te2);
crudService.update(find);
crudService.flush();
crudService.getEntityManager().clear();
find = crudService.find(TodoList.class, id);
Iterator<TodoEntry> iterator = find.getEntries().iterator();
iterator.next();
iterator.remove();
crudService.flush();
crudService.getEntityManager().clear();