Package openbook.domain

Examples of openbook.domain.Author


        }

        List<Author> allAuthors = new ArrayList<Author>();
        System.err.println("Creating " + nAuthor + " new Authors");
        for (int i = 1; i <= nAuthor; i++) {
            Author author = new Author();
            author.setName("Author-"+i);
            allAuthors.add(author);
            em.persist(author);
        }
        System.err.println("Creating " + nBook + " new Books");
        System.err.println("Linking at most " + nAuthorPerBook + " Authors per Book");
        for (int i = 1; i <= nBook; i++) {
            Book book = new Book(Randomizer.randomString(4,2),
                                 "Book-" + i,
                                 Randomizer.random(priceMin, priceMax),
                                 Randomizer.random(stockMin, stockMax));
            List<Author> authors = Randomizer.selectRandom(allAuthors,
                    Math.max(1, Randomizer.random(nAuthorPerBook)));
            for (Author author : authors) {
                author.addBook(book);
                book.addAuthor(author);
            }
            em.persist(book);
        }
       
View Full Code Here


        }

        List<Author> allAuthors = new ArrayList<Author>();
        System.err.println("Creating " + nAuthor + " new Authors");
        for (int i = 1; i <= nAuthor; i++) {
            Author author = new Author();
            author.setName("Author-"+i);
            allAuthors.add(author);
            em.persist(author);
        }
        System.err.println("Creating " + nBook + " new Books");
        System.err.println("Linking at most " + nAuthorPerBook + " Authors per Book");
        for (int i = 1; i <= nBook; i++) {
            Book book = new Book(Randomizer.randomString(4,2),
                                 "Book-" + i,
                                 Randomizer.random(priceMin, priceMax),
                                 Randomizer.random(stockMin, stockMax));
            List<Author> authors = Randomizer.selectRandom(allAuthors,
                    Math.max(1, Randomizer.random(nAuthorPerBook)));
            for (Author author : authors) {
                author.addBook(book);
                book.addAuthor(author);
            }
            em.persist(book);
        }
       
View Full Code Here

TOP

Related Classes of openbook.domain.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.