openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r712817 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/det...
Date Mon, 10 Nov 2008 19:55:00 GMT
Author: fancy
Date: Mon Nov 10 11:55:00 2008
New Revision: 712817

URL: http://svn.apache.org/viewvc?rev=712817&view=rev
Log:
OPENJPA-755 Update to SingleFieldManager to permit detached related entities on a merge with
cascade persist.
cosmatic changes only - removed tabs.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachedEntityCascadePersist.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomer.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomerInventory.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMItem.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java?rev=712817&r1=712816&r2=712817&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
Mon Nov 10 11:55:00 2008
@@ -744,7 +744,7 @@
             return;
 
         OpenJPAStateManager sm;        
-        
+
         if (vmd.getCascadePersist() == ValueMetaData.CASCADE_NONE) {
             if (!_broker.isDetachedNew() && _broker.isDetached(obj))
                 return; // allow but ignore
@@ -755,7 +755,7 @@
                     _loc.get("cant-cascade-persist", vmd))
                     .setFailedObject(obj);
         } else {
-        	if (vmd.getCascadePersist() == ValueMetaData.CASCADE_IMMEDIATE) {
+            if (vmd.getCascadePersist() == ValueMetaData.CASCADE_IMMEDIATE) {
                 if (!_broker.isDetachedNew() && _broker.isDetached(obj))
                     return; // allow but ignore
             }        	

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachedEntityCascadePersist.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachedEntityCascadePersist.java?rev=712817&r1=712816&r2=712817&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachedEntityCascadePersist.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachedEntityCascadePersist.java
Mon Nov 10 11:55:00 2008
@@ -27,18 +27,18 @@
 
 public class TestDetachedEntityCascadePersist extends SingleEMFTestCase {
 
-	public void setUp() {		
+    public void setUp() {		
         setUp(
-        	CLEAR_TABLES,
-        	DMCustomer.class, 
-        	DMItem.class,
-        	DMCustomerInventory.class
-        );        
+            CLEAR_TABLES,
+            DMCustomer.class,
+            DMItem.class,
+            DMCustomerInventory.class
+        );
     }
-	
+
     public void testDetachedEntityCascadePersist() {
-    	// Persist an item for finding later 
-    	EntityManager em = emf.createEntityManager();
+        // Persist an item for finding later 
+        EntityManager em = emf.createEntityManager();
         DMItem item = new DMItem(); 
         item.setName("openjpa");
         item.setPrice(0.0);
@@ -51,7 +51,7 @@
         em.persist(customer);
         em.getTransaction().commit();
         em.close();
-        
+
         em = emf.createEntityManager();
         DMItem itemDetached = em.find(DMItem.class, item.getId());
         em.close();        

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomer.java?rev=712817&r1=712816&r2=712817&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomer.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomer.java
Mon Nov 10 11:55:00 2008
@@ -29,8 +29,8 @@
 
 @Entity 
 public class DMCustomer {
-    
-	private static long idCounter = System.currentTimeMillis();	
+
+    private static long idCounter = System.currentTimeMillis();	
     @Id private long id = idCounter++;    
     private String firstName;    
     private String lastName;    
@@ -38,40 +38,40 @@
     @OneToMany(mappedBy="customer", 
             fetch=FetchType.EAGER,
             cascade=CascadeType.ALL)
-    private List<DMCustomerInventory> customerInventories = new ArrayList<DMCustomerInventory>();
-    
+            private List<DMCustomerInventory> customerInventories = new ArrayList<DMCustomerInventory>();
+
     public DMCustomer() {
     }
 
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public String getFirstName() {
-		return firstName;
-	}
-
-	public void setFirstName(String firstName) {
-		this.firstName = firstName;
-	}
-
-	public String getLastName() {
-		return lastName;
-	}
-
-	public void setLastName(String lastName) {
-		this.lastName = lastName;
-	}
-
-	public List<DMCustomerInventory> getCustomerInventories() {
-		return customerInventories;
-	}
-
-	public void setCustomerInventories(List<DMCustomerInventory> customerInventories)
{
-		this.customerInventories = customerInventories;
-	}
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public List<DMCustomerInventory> getCustomerInventories() {
+        return customerInventories;
+    }
+
+    public void setCustomerInventories(List<DMCustomerInventory> customerInventories)
{
+        this.customerInventories = customerInventories;
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomerInventory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomerInventory.java?rev=712817&r1=712816&r2=712817&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomerInventory.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMCustomerInventory.java
Mon Nov 10 11:55:00 2008
@@ -26,50 +26,50 @@
 
 @Entity
 public class DMCustomerInventory  {
-	private static long idCounter = System.currentTimeMillis();
+    private static long idCounter = System.currentTimeMillis();
     @Id private long id = idCounter++;
-    
+
     @ManyToOne(cascade=CascadeType.ALL)
     @JoinColumn(name = "CI_ITEMID")
     private DMItem  item;    
     private int quantity;
-    
+
     @ManyToOne(cascade=CascadeType.MERGE)
     @JoinColumn(name="CI_CUSTOMERID")
     private DMCustomer customer;
-    
+
     public DMCustomerInventory() {
     }
 
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public DMItem getItem() {
-		return item;
-	}
-
-	public void setItem(DMItem item) {
-		this.item = item;
-	}
-
-	public int getQuantity() {
-		return quantity;
-	}
-
-	public void setQuantity(int quantity) {
-		this.quantity = quantity;
-	}
-
-	public DMCustomer getCustomer() {
-		return customer;
-	}
-
-	public void setCustomer(DMCustomer customer) {
-		this.customer = customer;
-	}    
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public DMItem getItem() {
+        return item;
+    }
+
+    public void setItem(DMItem item) {
+        this.item = item;
+    }
+
+    public int getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(int quantity) {
+        this.quantity = quantity;
+    }
+
+    public DMCustomer getCustomer() {
+        return customer;
+    }
+
+    public void setCustomer(DMCustomer customer) {
+        this.customer = customer;
+    }    
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMItem.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMItem.java?rev=712817&r1=712816&r2=712817&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMItem.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/model/DMItem.java
Mon Nov 10 11:55:00 2008
@@ -23,29 +23,29 @@
 
 @Entity
 public class DMItem {
-	private static long idCounter = System.currentTimeMillis();	
-	@Id private long id = idCounter++;
+    private static long idCounter = System.currentTimeMillis();	
+    @Id private long id = idCounter++;
 
-	private String name;
-	private double price;
-	
-	
-	public long getId() {
-		return id;
-	}
-	public void setId(long id) {
-		this.id = id;
-	}
-	public String getName() {
-		return name;
-	}
-	public void setName(String name) {
-		this.name = name;
-	}
-	public double getPrice() {
-		return price;
-	}
-	public void setPrice(double price) {
-		this.price = price;
-	}
+    private String name;
+    private double price;
+
+
+    public long getId() {
+        return id;
+    }
+    public void setId(long id) {
+        this.id = id;
+    }
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public double getPrice() {
+        return price;
+    }
+    public void setPrice(double price) {
+        this.price = price;
+    }
 }



Mime
View raw message