Examples of DMItem


Examples of org.apache.openjpa.persistence.detachment.model.DMItem

    public void testDetachRemovesEntityAndCascadedRelationFromContext() {
        em.getTransaction().begin();
       
        DMCustomer pc = em.find(DMCustomer.class, root.getId());
        List<DMCustomerInventory> inventories = pc.getCustomerInventories();
        DMItem item = inventories.get(0).getItem();
       
        assertNotDetached(pc);
        for (DMCustomerInventory i : inventories) assertNotDetached(i);
        assertNotDetached(item);  
       
View Full Code Here

Examples of org.apache.openjpa.persistence.detachment.model.DMItem

    public void testManagedEntityContinuesToReferDetachedEntities() {
        em.getTransaction().begin();
       
        DMCustomer pc = em.find(DMCustomer.class, root.getId());
        List<DMCustomerInventory> inventories = pc.getCustomerInventories();
        DMItem item = inventories.get(1).getItem();
       
        em.detach(inventories.get(0));
       
        DMCustomerInventory attached0 = inventories.get(0);
        DMCustomerInventory attached1 = inventories.get(1);
View Full Code Here

Examples of org.apache.openjpa.persistence.detachment.model.DMItem

       
        em.getTransaction().rollback();
    }
   
    DMCustomer createData() {
        DMItem item1 = new DMItem();
        DMItem item2 = new DMItem();
        item1.setName("item-1"); item1.setPrice(100.0);
        item2.setName("item-2"); item2.setPrice(200.0);
       
        DMCustomerInventory inventory1 = new DMCustomerInventory();
        DMCustomerInventory inventory2 = new DMCustomerInventory();
        inventory1.setItem(item1); inventory1.setQuantity(10);
        inventory2.setItem(item2); inventory2.setQuantity(20);
View Full Code Here

Examples of org.apache.openjpa.persistence.detachment.model.DMItem

    }

    public void testDetachedEntityCascadePersist() {
        // Persist an item for finding later
        EntityManager em = emf.createEntityManager();
        DMItem item = new DMItem();
        item.setName("openjpa");
        item.setPrice(0.0);
        em.getTransaction().begin();       
        em.persist(item);
        // Persist a customer for finding later
        DMCustomer customer = new DMCustomer();
        customer.setFirstName("Open");
        customer.setLastName("JPA");
        em.persist(customer);
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        DMItem itemDetached = em.find(DMItem.class, item.getId());
        em.close();       
        em = emf.createEntityManager();
        DMCustomer customer2 = em.find(DMCustomer.class, customer.getId());      
        DMCustomerInventory customerInventory = new DMCustomerInventory();
        customerInventory.setCustomer(customer2);
View Full Code Here

Examples of org.apache.openjpa.persistence.detachment.model.DMItem

    }

    public void testDetachedEntityCascadePersist() {
        // Persist an item for finding later
        EntityManager em = emf.createEntityManager();
        DMItem item = new DMItem();
        item.setName("openjpa");
        item.setPrice(0.0);
        em.getTransaction().begin();       
        em.persist(item);
        // Persist a customer for finding later
        DMCustomer customer = new DMCustomer();
        customer.setFirstName("Open");
        customer.setLastName("JPA");
        em.persist(customer);
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        DMItem itemDetached = em.find(DMItem.class, item.getId());
        em.close();       
        em = emf.createEntityManager();
        DMCustomer customer2 = em.find(DMCustomer.class, customer.getId());
        DMCustomerInventory customerInventory = new DMCustomerInventory();
        customerInventory.setCustomer(customer2);
View Full Code Here

Examples of org.apache.openjpa.persistence.detachment.model.DMItem

    public void testDetachRemovesEntityAndCascadedRelationFromContext() {
        em.getTransaction().begin();
       
        DMCustomer pc = em.find(DMCustomer.class, root.getId());
        List<DMCustomerInventory> inventories = pc.getCustomerInventories();
        DMItem item = inventories.get(0).getItem();
       
        assertNotDetached(pc);
        for (DMCustomerInventory i : inventories) assertNotDetached(i);
        assertNotDetached(item);  
       
View Full Code Here

Examples of org.apache.openjpa.persistence.detachment.model.DMItem

    public void testManagedEntityContinuesToReferDetachedEntities() {
        em.getTransaction().begin();
       
        DMCustomer pc = em.find(DMCustomer.class, root.getId());
        List<DMCustomerInventory> inventories = pc.getCustomerInventories();
        DMItem item = inventories.get(1).getItem();
       
        em.detach(inventories.get(0));
       
        DMCustomerInventory attached0 = inventories.get(0);
        DMCustomerInventory attached1 = inventories.get(1);
View Full Code Here

Examples of org.apache.openjpa.persistence.detachment.model.DMItem

       
        em.getTransaction().rollback();
    }
   
    DMCustomer createData() {
        DMItem item1 = new DMItem();
        DMItem item2 = new DMItem();
        item1.setName("item-1"); item1.setPrice(100.0);
        item2.setName("item-2"); item2.setPrice(200.0);
       
        DMCustomerInventory inventory1 = new DMCustomerInventory();
        DMCustomerInventory inventory2 = new DMCustomerInventory();
        inventory1.setItem(item1); inventory1.setQuantity(10);
        inventory2.setItem(item2); inventory2.setQuantity(20);
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.