Examples of Make


Examples of org.apache.openjpa.persistence.merge.model.Make

        EntityManager em = emf.createEntityManager();

        try {
          Car c1 = new Car();
          Car c2 = new Car();
          Make mk1 = new Make();
          ArrayList<Model> models = new ArrayList<Model>();
          Model md1 = new Model();
          models.add(md1);
          Model md2 = new Model();
          models.add(md2);

          //populate bidirectional relationships
          c1.setModel(md1);
          c2.setModel(md2);         
          md1.setCar(c1);
          md1.setMake(mk1);
          md2.setCar(c2);
          md1.setMake(mk1);
          mk1.setModels(models);
                     
            // Persist car1 - will cascade
            em.getTransaction().begin();
            em.persist(c1);
            em.getTransaction().commit();
View Full Code Here

Examples of org.apache.openjpa.persistence.merge.model.Make

          if (entity instanceof Car) {
            Car c = (Car)entity;
            assertFalse(em.contains(c.getModel()));
          }
          else if (entity instanceof Make) {
            Make m = (Make)entity;
            List<Model> mds = m.getModels();
            for (Model md : mds) {
              assertFalse(em.contains(md));
            }
          }
          else if (entity instanceof Model) {
            Model m = (Model)entity;
            assertFalse(em.contains(m.getCar()));
            assertFalse(em.contains(m.getMake()));
          }
        }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.