openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r764041 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-persistence-jdbc/src/ma...
Date Fri, 10 Apr 2009 20:38:29 GMT
Author: jrbauer
Date: Fri Apr 10 20:38:28 2009
New Revision: 764041

URL: http://svn.apache.org/viewvc?rev=764041&view=rev
Log:
OPENJPA-1034 Remove OrderColumn attributes and corresponding tests

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerCollectionTableFieldStrategy.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyTableFieldStrategy.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingSerializer.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java?rev=764041&r1=764040&r2=764041&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
Fri Apr 10 20:38:28 2009
@@ -679,8 +679,6 @@
         boolean relationId = tmplate.isRelationId();
         boolean implicitRelation = tmplate.isImplicitRelation();
         String targetField = tmplate.getTargetField();
-        int base = tmplate.getBase();
-        boolean contiguous = tmplate.isContiguous();
         if (given != null) {
             // use given type if provided, but warn if it isn't compatible with
             // the expected column type
@@ -699,8 +697,6 @@
             typeName = given.getTypeName();
             size = given.getSize();
             decimals = given.getDecimalDigits();
-            base = given.getBase();
-            contiguous = given.isContiguous();
 
             // leave this info as the template defaults unless the user
             // explicitly turns it on in the given column
@@ -760,8 +756,6 @@
         col.setRelationId(relationId);
         col.setImplicitRelation(implicitRelation);
         col.setTargetField(targetField);
-        col.setContiguous(contiguous);
-        col.setBase(base);
 
         // we need this for runtime, and the dynamic schema factory might
         // not know it, so set it even if not adapting

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerCollectionTableFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerCollectionTableFieldStrategy.java?rev=764041&r1=764040&r2=764041&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerCollectionTableFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerCollectionTableFieldStrategy.java
Fri Apr 10 20:38:28 2009
@@ -149,7 +149,7 @@
         ValueMapping elem = field.getElementMapping();
         Column order = field.getOrderColumn();
         boolean setOrder = field.getOrderColumnIO().isInsertable(order, false);
-        int idx = (setOrder && order != null) ? order.getBase() : 0;
+        int idx = 0;
         for (Iterator itr = coll.iterator(); itr.hasNext(); idx++) {
             HandlerStrategies.set(elem, itr.next(), store, row, _cols,
                 _io, true);

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyTableFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyTableFieldStrategy.java?rev=764041&r1=764040&r2=764041&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyTableFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyTableFieldStrategy.java
Fri Apr 10 20:38:28 2009
@@ -162,7 +162,7 @@
         StoreContext ctx = sm.getContext();
         Column order = field.getOrderColumn();
         boolean setOrder = field.getOrderColumnIO().isInsertable(order, false);
-        int idx = (setOrder && order != null) ? order.getBase() : 0;
+        int idx = 0;
         OpenJPAStateManager esm;
         for (Iterator itr = coll.iterator(); itr.hasNext(); idx++) {
             esm = RelationStrategies.getStateManager(itr.next(), ctx);

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java?rev=764041&r1=764040&r2=764041&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java Fri
Apr 10 20:38:28 2009
@@ -75,9 +75,6 @@
     private VersionStrategy _versionStrategy = null;
     private String _comment = null;
     private boolean _XML = false;
-
-    private boolean _contiguous = true;
-    private int _base = 0;
     
     /**
      * Default constructor.
@@ -727,10 +724,6 @@
             _flags = from._flags;
         if (!isXML())
             setXML(from.isXML());
-        if (getBase() == 0)
-            setBase(from.getBase());
-        if (isContiguous())
-            setContiguous(from.isContiguous());
     }
     
     /**
@@ -790,40 +783,4 @@
     public void setImplicitRelation(boolean flag) {
     	_implicitRelation |= flag;
     }
-    
-    /**
-     * Sets whether the column values should be contiguous for a column
-     * purposed as an order column
-     * 
-     * @param contiguous
-     */
-    public void setContiguous(boolean contiguous) {
-        _contiguous = contiguous;
-    }
-
-    /**
-     * Gets whether the column values should be contiguous for a column
-     * purposed as an order column
-     * 
-     * @param contiguous
-     */
-    public boolean isContiguous() {
-        return _contiguous;
-    }
-    
-    /**
-     * Sets the base value for a column purposed as an order column
-     * @param base integral base value to begin ordering
-     */
-    public void setBase(int base) {
-        _base = base;
-    }
-    
-    /**
-     * Gets the base value for a column purposed as an order column
-     * @param base
-     */
-    public int getBase() {
-        return _base;
-    }  
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java?rev=764041&r1=764040&r2=764041&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
Fri Apr 10 20:38:28 2009
@@ -1147,14 +1147,6 @@
         val = attrs.getValue("updatable");
         if (val != null)
             col.setFlag(Column.FLAG_UNUPDATABLE, "false".equals(val));
-
-        val = attrs.getValue("base");
-        if (val != null)
-            col.setBase(Integer.parseInt(val));
-        
-        val = attrs.getValue("contiguous");
-        if (val != null)
-            col.setContiguous("false".equals(val));
         
         val = attrs.getValue("table");
         if (val != null) {

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingSerializer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingSerializer.java?rev=764041&r1=764040&r2=764041&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingSerializer.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingSerializer.java
Fri Apr 10 20:38:28 2009
@@ -457,10 +457,6 @@
                 addAttribute("updatable", "false");
             if (orderCol.getTypeName() != null)
                 addAttribute("column-definition", orderCol.getTypeName());
-            if (orderCol.isContiguous() != true)
-                addAttribute("contiguous", "false");
-            if (orderCol.getBase() != 0)
-                addAttribute("base", orderCol.getBase() + "");
             if (orderCol.getTableName() != null)
                 addAttribute("table", orderCol.getTableName());
             startElement("order-column");

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java?rev=764041&r1=764040&r2=764041&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java
Fri Apr 10 20:38:28 2009
@@ -521,84 +521,6 @@
     }
 
     /*
-     * Validates the default base value on OrderColumn
-     */
-    public void testOrderColumnBase() {
-        
-        OpenJPAEntityManagerFactorySPI emf1 = 
-            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
-            createEntityManagerFactory("BaseTest", 
-            "org/apache/openjpa/persistence/jdbc/order/" +
-            "order-persistence.xml");
-        
-        // Verify order column names are as expected
-        validateOrderColumnName(emf1, BaseTestEntity.class, "collelems", 
-            "collelems_ORDER"); 
-
-        validateOrderColumnName(emf1, BaseTestEntity.class, "one2Melems", 
-             "one2MOrder"); 
-
-        validateOrderColumnName(emf1, BaseTestEntity.class, "m2melems", 
-             "m2morder"); 
-
-        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
-        
-        // Create a collection with a non-default base value
-        BaseTestEntity bte = new BaseTestEntity();
-        BaseTestElement[] elems = new BaseTestElement[9];
-        for (int i = 0; i < 9; i++) {
-            int elemnum =  (i % 3 ) + 1; 
-            elems[i] = new BaseTestElement("Element " + elemnum); 
-        }
-
-        // Add to element collection with base value 0
-        Set<BaseTestElement> elemset = new LinkedHashSet<BaseTestElement>();
-        for (int i = 0; i < 3; i++)
-            elemset.add(elems[i]);
-        bte.setCollelems(elemset);
-
-        // Add to OneToMany with base value 0
-        List<BaseTestElement> elemList = new ArrayList<BaseTestElement>();
-        for (int i = 0; i < 3; i++)
-            elemList.add(elems[i + 3]);
-        bte.setOne2Melems(elemList);
-        
-        // Add to ManyToMany, base value 0
-        List<BaseTestElement> elemList2 = new ArrayList<BaseTestElement>();
-        for (int i = 0; i < 3; i++)
-            elemList2.add(elems[i + 6]);
-        bte.setM2melems(elemList2);
-        
-        em.getTransaction().begin();
-        em.persist(bte);
-        em.getTransaction().commit();
-        
-        // Do a projection query to verify the base values
-
-        validateIndexAndValues(em, "BaseTestEntity", "one2Melems", 0, 
-                new Object[] { elems[3], elems[4], elems[5]}, "id", 
-                bte.getId());
-
-        validateIndexAndValues(em, "BaseTestEntity", "m2melems", 0, 
-                new Object[] { elems[6], elems[7], elems[8]}, "id",
-                bte.getId());
-
-// This validator is disabled until INDEX projection supports element 
-// collections
-//        validateIndexAndValues(em, "BaseTestEntity", "collelems", 0, 
-//                new Object[] { elems[0], elems[1], elems[2]} "id",
-//                bte.getId());
-
-        em.close();
-        try {
-            if (emf1 != null)
-                cleanupEMF(emf1);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-    }
-
-    /*
      * Validates the use of the table attribute on OrderColumn with
      * o2o, o2m, m2m, and collection table - with and without join
      * tables.
@@ -671,11 +593,9 @@
                 widgetArr, "id", 
                 oid);
 
-//      This validator is disabled until INDEX projection supports element 
-//      collections
-//        validateIndexAndValues(em, "Owner", "bikeColl", 0, 
-//                bikeArr, "id", 
-//                oid);
+        validateIndexAndValues(em, "Owner", "bikeColl", 0, 
+                bikeArr, "id", 
+                oid);
         
         em.close();
     }    
@@ -857,19 +777,16 @@
         Column oc = fm.getOrderColumn();
         assertNotNull(oc);
         assertEquals(oc.getName(),"one2MOrder");
-        assertEquals(oc.getBase(), 0);
 
         fm = (FieldMapping)_entityMeta2.getField("m2melems");
         oc = fm.getOrderColumn();
         assertNotNull(oc);
         assertEquals(oc.getName(),"m2morder");
-        assertEquals(oc.getBase(), 0);
 
         fm = (FieldMapping)_entityMeta2.getField("collelems");
         oc = fm.getOrderColumn();
         assertNotNull(oc);
         assertEquals(oc.getName(),"collelems_ORDER");
-        assertEquals(oc.getBase(), 0);    
 
         try {
             if (emf1 != null)
@@ -977,13 +894,6 @@
             // Verify the table exists in the db
             assertTrue(tableAndColumnExists(emf1, null, tableName, null, 
                 columnName));
-        }
-
-    private void validateOrderColumnContiguous(
-        OpenJPAEntityManagerFactorySPI emf1, Class clazz, String fieldName, 
-        boolean contiguous) {        
-        Column oc = getOrderColumn(emf1, clazz, fieldName);
-        assertTrue(oc.isContiguous() == contiguous);
     }
 
     private void validateOrderColumnDef(



Mime
View raw message