Package org.hibernate.examples.mapping.associations.onetoone.primarykey

Examples of org.hibernate.examples.mapping.associations.onetoone.primarykey.OneToOneAuthor


     * @throws Exception
     */
    @Test
    @Rollback(false)
    public void authorBiography() throws Exception {
        OneToOneAuthor author = new OneToOneAuthor();
        author.setName("debop");

        author.getBiography().setInformation("Sunghyouk Bae");
        author.getPicture().setPath("file://a/b/c");

        em.persist(author);
        em.flush();
        em.clear();

        author = em.find(OneToOneAuthor.class, author.getId());
        assertThat(author).isNotNull();
        OneToOneBiography bio = author.getBiography();
        assertThat(bio).isNotNull();
        assertThat(bio.getInformation()).isEqualToIgnoringCase("Sunghyouk Bae");

        author.getBiography().setInformation("debop");
        em.persist(author);
        em.flush();
        em.clear();

        author = em.find(OneToOneAuthor.class, author.getId());
        assertThat(author).isNotNull();
        assertThat(author.getBiography().getInformation()).isEqualToIgnoringCase("debop");
    }
View Full Code Here

TOP

Related Classes of org.hibernate.examples.mapping.associations.onetoone.primarykey.OneToOneAuthor

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.