Package org.hibernate.ogm.examples.gettingstarted.domain

Examples of org.hibernate.ogm.examples.gettingstarted.domain.Dog


      logger.infof( "About to store dog and breed" );
      EntityManager em = emf.createEntityManager();
      Breed collie = new Breed();
      collie.setName( "Collie" );
      em.persist( collie );
      Dog dina = new Dog();
      dina.setName( "Dina" );
      dina.setBreed( collie );
      em.persist( dina );
      Long dinaId = dina.getId();
      em.flush();
      em.close();
      tm.commit();

      //Retrieve your entities the way you are used to in plain JPA
      logger.infof( "About to retrieve dog and breed" );
      tm.begin();
      em = emf.createEntityManager();
      dina = em.find( Dog.class, dinaId );
      logger.infof( "Found dog %s of breed %s", dina.getName(), dina.getBreed().getName() );
      em.flush();
      em.close();
      tm.commit();

      emf.close();
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.examples.gettingstarted.domain.Dog

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.