Package org.hibernate.examples.mapping.compositeId.embeddable

Examples of org.hibernate.examples.mapping.compositeId.embeddable.EmbeddableIdCar


    @PersistenceContext
    EntityManager em;

    @Test
    public void embeddedidTest() {
        EmbeddableIdCar car = new EmbeddableIdCar(new EmbeddableCarIdentifier("Kia", 2012));
        car.setSerialNo("6675");

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

        EmbeddableIdCar loaded = em.find(EmbeddableIdCar.class, car.getId());
        assertThat(loaded).isNotNull();
        assertThat(loaded.getId()).isNotNull();
        assertThat(loaded.getId().getBrand()).isEqualTo("Kia");

        loaded.setSerialNo("5081");
        em.persist(loaded);
        em.flush();
        em.clear();

        loaded = em.find(EmbeddableIdCar.class, new EmbeddableCarIdentifier("Kia", 2012));
View Full Code Here

TOP

Related Classes of org.hibernate.examples.mapping.compositeId.embeddable.EmbeddableIdCar

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.