Package org.ops4j.pax.exam.sample6.model

Examples of org.ops4j.pax.exam.sample6.model.Author


    Category category2 = new Category();
    category2.setTitle("Littérature");
    entityManager.persist(category2);

    Author author1 = new Author();
    author1.setFirstName("Michel");
    author1.setLastName("Martin");
    entityManager.persist(author1);

    Author author2 = new Author();
    author2.setFirstName("Christian");
    author2.setLastName("Bauer");
    entityManager.persist(author2);

    Author author3 = new Author();
    author3.setFirstName("J-K");
    author3.setLastName("Rowling");
    entityManager.persist(author3);

    Book book = new Book();
    book.setTitle("HTML 5 et CSS 3");
    book.setCategory(category1);
View Full Code Here


    @Inject
    private AuthorRepository repo;

    @Test
    public void byAuthor() {
        Author author = new Author();
        author.setFirstName("Heinrich");
        author.setLastName("Heine");
        repo.saveAndFlush(author);
       
        assertThat(repo.count(), is(3L));
    }
View Full Code Here

        List<Book> books = query.getResultList();
        return books;
    }

    public Author createAuthor(String firstName, String lastName) {
        Author author = new Author();
        author.setFirstName(firstName);
        author.setLastName(lastName);
        em.persist(author);
        return author;
    }
View Full Code Here

        log.info("filling library");
        if (libraryService.getNumBooks() != 0) {
            return;
        }

        Author mann = libraryService.createAuthor("Thomas", "Mann");
        Author steinbeck = libraryService.createAuthor("John", "Steinbeck");

        libraryService.createBook("Buddenbrooks", mann);
        libraryService.createBook("East of Eden", steinbeck);
    }
View Full Code Here

    @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);
View Full Code Here

    public void fillLibrary() {
        if (getNumBooks() != 0) {
            return;
        }

        Author mann = createAuthor("Thomas", "Mann");
        Author steinbeck = createAuthor("John", "Steinbeck");

        createBook("Buddenbrooks", mann);
        createBook("East of Eden", steinbeck);
    }
View Full Code Here

        return books;
    }

    public Author createAuthor(String firstName, String lastName) {
        em.getTransaction().begin();
        Author author = new Author();
        author.setFirstName(firstName);
        author.setLastName(lastName);
        em.persist(author);
        em.flush();
        em.getTransaction().commit();
        return author;
    }
View Full Code Here

    @TransactionAttribute
    public void fillLibrary() {
        if (getNumBooks() != 0) {
            return;
        }
        Author mann = createAuthor("Thomas", "Mann");
        Author steinbeck = createAuthor("John", "Steinbeck");

        createBook("Buddenbrooks", mann);
        createBook("East of Eden", steinbeck);
    }
View Full Code Here

        return books;
    }

    @TransactionAttribute
    public Author createAuthor(String firstName, String lastName) {
        Author author = new Author();
        author.setFirstName(firstName);
        author.setLastName(lastName);
        em.persist(author);
        return author;
    }
View Full Code Here

    public void fillLibrary() {
        if (libraryService.getNumBooks() != 0) {
            return;
        }

        Author mann = libraryService.createAuthor("Thomas", "Mann");
        Author steinbeck = libraryService.createAuthor("John", "Steinbeck");

        libraryService.createBook("Buddenbrooks", mann);
        libraryService.createBook("East of Eden", steinbeck);
    }
View Full Code Here

TOP

Related Classes of org.ops4j.pax.exam.sample6.model.Author

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.