@Before
public void setUp() {
if (getNumBooks() != 0)
return;
Author mann = new Author();
mann.setFirstName("Thomas");
mann.setLastName("Mann");
Author steinbeck = new Author();
steinbeck.setFirstName("John");
steinbeck.setLastName("Steinbeck");
Book buddenbrooks = new Book();
buddenbrooks.setTitle("Buddenbrooks");
buddenbrooks.setAuthor(mann);
mann.getBooks().add(buddenbrooks);
Book eden = new Book();
eden.setTitle("East of Eden");
eden.setAuthor(steinbeck);
steinbeck.getBooks().add(eden);
em.getTransaction().begin();
em.persist(mann);
em.persist(steinbeck);
em.persist(buddenbrooks);