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

Examples of org.hibernate.examples.mapping.associations.onetoone.unidirectionalOneToOne.Wheel


    public void unidirectionalOneToOne() throws Exception {

        Vehicle vehicle = new Vehicle();
        vehicle.setBrand("Mercedes");

        Wheel wheel = new Wheel();
        wheel.setVehicle(vehicle);

        em.persist(vehicle);
        em.persist(wheel);
        em.flush();
        em.clear();

        log.debug("Wheel=[{}]", wheel);

        wheel = em.find(Wheel.class, wheel.getId());
        assertThat(wheel).isNotNull();

        vehicle = wheel.getVehicle();
        assertThat(vehicle).isNotNull();

        em.remove(wheel);
        em.remove(vehicle);
        em.flush();
View Full Code Here

TOP

Related Classes of org.hibernate.examples.mapping.associations.onetoone.unidirectionalOneToOne.Wheel

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.