Package com.force.samples.entity

Examples of com.force.samples.entity.Author


    tx.commit();
  }

  private static void populateCannedData(EntityManager em) {
   
    Author author = new Author();
    author.setFirstName("JRR");
    author.setLastName("Tolkein");

    Book hobbit = new Book();
    hobbit.setAuthor(author);
    hobbit.setTitle("The Hobbit");
    hobbit.setPublicationDate(new GregorianCalendar(1937, 11, 1).getTime());
    em.persist(hobbit);
   
    Book fotr = new Book();
    fotr.setAuthor(author);
    fotr.setTitle("Fellowship of the Ring");
    fotr.setPublicationDate(new GregorianCalendar(1954, 06, 24).getTime());
    em.persist(fotr);
   
    Book twoTowers = new Book();
    twoTowers.setAuthor(author);
    twoTowers.setTitle("The Two Towers");
    twoTowers.setPublicationDate(new GregorianCalendar(1954, 10, 11).getTime());
    em.persist(twoTowers);
   
    Book rotk = new Book();
    rotk.setAuthor(author);
    rotk.setTitle("Return of the King");
    rotk.setPublicationDate(new GregorianCalendar(1955, 9, 20).getTime());
    em.persist(rotk);
   
    Author rowling = new Author();
    rowling.setFirstName("J.K");
    rowling.setLastName("Rowling");
   
    Book hpps = new Book();
    hpps.setAuthor(rowling);
    hpps.setTitle("Harry Potter and the Philosophers Stone");
    hpps.setPublicationDate(new GregorianCalendar(1997, 5, 30).getTime());
View Full Code Here


   
    log.info("Creating and persisting entity...");
    EntityTransaction tx = em.getTransaction();
    tx.begin();
   
    Author author = new Author();
    author.setFirstName("JRR");
    author.setLastName("Tolkein");

    Book book = new Book();
    book.setAuthor(author);
    book.setTitle("Fellowship of the Ring");
    book.setPublicationDate(new GregorianCalendar(1954, 06, 24).getTime());
View Full Code Here

TOP

Related Classes of com.force.samples.entity.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.