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

Examples of org.hibernate.examples.mapping.associations.onetoone.unidirectionalManyToOne.Cavalier


        Horse horse = new Horse();
        horse.setName("Palefrenier");
        em.persist(horse);

        Cavalier cavalier = new Cavalier();
        cavalier.setName("Caroline");
        cavalier.setHorse(horse);
        em.persist(cavalier);

        em.flush();
        em.clear();

        cavalier = em.find(Cavalier.class, cavalier.getId());
        assertThat(cavalier).isNotNull();

        horse = cavalier.getHorse();
        assertThat(horse).isNotNull();

        em.remove(cavalier);
        em.remove(horse);
        em.flush();
View Full Code Here

TOP

Related Classes of org.hibernate.examples.mapping.associations.onetoone.unidirectionalManyToOne.Cavalier

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.