tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adrianocrest...@apache.org
Subject svn commit: r565681 - in /incubator/tuscany/java/das/rdb: ./ src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ src/test/java/org/apache/tuscany/das/rdb/test/ src/test/java/org/apache/tuscany/das/rdb/test/commands/ src/test/java/org/apache/tus...
Date Tue, 14 Aug 2007 09:53:42 GMT
Author: adrianocrestani
Date: Tue Aug 14 02:53:41 2007
New Revision: 565681

URL: http://svn.apache.org/viewvc?view=rev&rev=565681
Log:
applying patch from JIRA-1464

Added:
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java
    incubator/tuscany/java/das/rdb/src/test/resources/MissingPK.xml
    incubator/tuscany/java/das/rdb/src/test/resources/MissingPKREL.xml
    incubator/tuscany/java/das/rdb/src/test/resources/companynoid.xsd
    incubator/tuscany/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml
Modified:
    incubator/tuscany/java/das/rdb/pom.xml
    incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java
    incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java
    incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java
    incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java
    incubator/tuscany/java/das/rdb/src/test/resources/company.xsd

Modified: incubator/tuscany/java/das/rdb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/pom.xml?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/pom.xml (original)
+++ incubator/tuscany/java/das/rdb/pom.xml Tue Aug 14 02:53:41 2007
@@ -93,6 +93,16 @@
 				</goals>
 			    </execution>
 			    <execution>
+				<id>companynoid</id>
+				<configuration>
+				    <schemaFile>${basedir}/src/test/resources/companynoid.xsd</schemaFile>
+				    <noUnsettable>true</noUnsettable>
+				</configuration>
+				<goals>
+				    <goal>generate</goal>
+				</goals>
+			    </execution>			    
+			    <execution>
 				<id>company</id>
 				<configuration>
 				    <schemaFile>${basedir}/src/test/resources/company.xsd</schemaFile>
@@ -151,6 +161,16 @@
 				</goals>
 			    </execution>
 			    <execution>
+				<id>companynoid</id>
+				<configuration>
+				    <schemaFile>${basedir}/src/test/resources/companynoid.xsd</schemaFile>
+				    <noUnsettable>true</noUnsettable>
+				</configuration>
+				<goals>
+				    <goal>generate</goal>
+				</goals>
+			    </execution>			    
+			    <execution>
 				<id>company</id>
 				<configuration>
 				    <schemaFile>${basedir}/src/test/resources/company.xsd</schemaFile>
@@ -225,5 +245,9 @@
 
 
 </project>
+
+
+
+
 
 

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java Tue Aug 14 02:53:41 2007
@@ -24,6 +24,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -54,6 +55,8 @@
 
     private Converter[] converters;
 
+    private Map tableToPrimaryKeysMap = new HashMap();
+    
     //JIRA-952
     public ResultMetadata(ResultSet rs, MappingWrapper cfgWrapper, ResultSetShape shape) throws SQLException {
 
@@ -70,6 +73,7 @@
 
         Map impliedRelationships = new HashMap();
         String schemaName = "";
+        String idSpell = null;
         for (int i = 1; i <= resultSetShape.getColumnCount(); i++) {
             String tableName = resultSetShape.getTableName(i);
              schemaName = resultSetShape.getSchemaName(i);
@@ -86,8 +90,9 @@
             }
             String columnName = resultSetShape.getColumnName(i);
 
-            if (columnName.indexOf("_ID") >= 0) {
-            	String colName = "";
+            String colName = "";
+            if (columnName.regionMatches(true, columnName.length()-3, "_ID", 0, 3)) {
+            	idSpell = columnName.substring(columnName.length()-3, columnName.length());            	
             	if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){
             		colName = schemaName+"."+columnName;
             		impliedRelationships.put(colName, schemaName+"."+tableName);
@@ -128,12 +133,16 @@
             }
             properties.add(propertyName);
             tableToPropertyMap.put(typeName, properties);
+            
         }
-
+        
+        //System.out.println("tableToPropertyMap "+tableToPropertyMap);
+        fillTableToPrimaryKeysMap();
+        
         Iterator i = impliedRelationships.keySet().iterator();
         while (i.hasNext()) {
             String columnName = (String) i.next();
-            String pkTableName = columnName.substring(0, columnName.indexOf("_ID"));
+            String pkTableName = columnName.substring(0, columnName.indexOf(idSpell));//_id, _Id, _iD, _ID anything
             String fkTableName = (String) impliedRelationships.get(columnName);
             List pkTableProperties = (List) tableToPropertyMap.get(pkTableName);
             if ((pkTableProperties != null) && (pkTableProperties.contains("ID"))) {
@@ -152,9 +161,71 @@
                 }
             }
         }
-
     }
 
+    //Now fill tableToPrimaryKeysMap.Complete for whichever tables are there in tableToPrimaryKeysMap,
+    //Also case of implied PK and it is not there in SELECT, provide way to still fill it in
+    //tableToPrimaryKeysMap - the column should be present in Config (though not defed as PK)
+    //And consider the classic case, when we assume all columns to be PKs - when no info
+    //in config for table or "all columns"
+    private void fillTableToPrimaryKeysMap(){
+	    Iterator itr = tableToPropertyMap.keySet().iterator();
+	    while(itr.hasNext()){
+	    	String curTableName = (String)itr.next();
+	    	boolean treatAllPKs = false;//flag for, when all cols need to be treated as PKs
+	    	
+	    	if(tableToPrimaryKeysMap.containsKey(curTableName)){
+	    		continue;//don't keep refilling same hashset for each ResultMetadata constructor,
+	    	}
+	    	
+	    	List columnsForTable = null;
+	    	if(configWrapper.getTableByTypeName(curTableName) != null) {
+	    		 columnsForTable = configWrapper.getTableByTypeName(curTableName).getColumn();        		 
+	    	}
+	    	else if(configWrapper.getTable(curTableName) != null){
+			 columnsForTable = configWrapper.getTable(curTableName).getColumn();
+			 configWrapper.getTable(curTableName).setTypeName(curTableName);//keep configWrapper consistent with Type info
+	    	}
+	    	else{
+	    		treatAllPKs = true;//can not find table/type, need to consider all columns as PKs
+	    	}
+	    	
+	    	if(columnsForTable != null){
+	            for(int ii=0; ii<columnsForTable.size(); ii++){
+	            	Column curCol = (Column)columnsForTable.get(ii);
+	            	
+	            	if(curCol.isPrimaryKey() || curCol.getColumnName().equalsIgnoreCase("ID")){//need to compare col name
+	            		//with ID as that is the one from dbms metadata or resul set shape metadata
+	            		//but when putting in map, need to put property and if not present then column
+	    	            Collection pks = (Collection) tableToPrimaryKeysMap.get(curTableName);
+	    	            if(pks == null){
+	    	            	pks = new HashSet();
+	    	            }
+	
+	    	            if(curCol.getPropertyName() != null){
+	    	            	pks.add(curCol.getPropertyName());
+	    	            }
+	    	            else{
+	        	            pks.add(curCol.getColumnName());
+	        	            curCol.setPropertyName(curCol.getColumnName());//make config consistent
+	        	            if(!((Collection)tableToPropertyMap.get(curTableName)).contains(curCol.getColumnName())){
+	        	            	((Collection)tableToPropertyMap.get(curTableName)).add(curCol.getColumnName());
+	        	            }
+	    	            }
+	    	            tableToPrimaryKeysMap.put(curTableName, pks);	        	            		
+	            	}
+	            }        		
+	    	}
+	    	else{
+	    		treatAllPKs = true;//table present in cfg , but no cols
+	    	}
+	    	
+	    	if(treatAllPKs){
+	    		tableToPrimaryKeysMap.put(curTableName, null);//case when all columns are considered PKs
+	    	}
+	    }
+    }
+    
     private Converter loadConverter(String converterName) {
         if (converterName != null) {
 
@@ -208,6 +279,17 @@
         return tableToPropertyMap.keySet();
     }
 
+    public HashSet getAllPKsForTable(String tableName){
+    	if(tableToPrimaryKeysMap.containsKey(tableName))
+    		return (HashSet)tableToPrimaryKeysMap.get(tableName);
+    	else{
+    		HashSet tmpHashSet = new HashSet();
+    		tmpHashSet.add("");//case when there were cols in cfg but could not find any PK in it and no ID column in cfg/result set
+    		return tmpHashSet;
+    	}
+    		
+    }
+    
     public String toString() {
 
         StringBuffer result = new StringBuffer(super.toString());

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java Tue Aug 14 02:53:41 2007
@@ -27,7 +27,7 @@
 import commonj.sdo.DataObject;
 
 /**
- * 
+ *
  * A ResultSetProcessor is used to transform the data in a ResultSet into a set of inter-related EDataObjects.
  */
 public class ResultSetProcessor {
@@ -58,12 +58,12 @@
 
     /**
      * Process the ResultSet. For each row in the ResultSet, a
-     * 
-     * @link ResultSetRow object will be created to represent the row as a set of EDataObjects. Then, 
+     *
+     * @link ResultSetRow object will be created to represent the row as a set of EDataObjects. Then,
      * the relevant relationships will be constructed
      *       between each object in the
      * @link ResultSetRow.
-     * 
+     *
      * @param start
      * @param end
      */
@@ -110,23 +110,41 @@
         while (tables.hasNext()) {
             TableData rawDataFromRow = (TableData) tables.next();
 
-            if (!rawDataFromRow.hasValidPrimaryKey()) {
-                continue;
+            if (!rawDataFromRow.hasValidPrimaryKey() ||
+            		(rawDataFromRow.hasNullPrimaryKey() && !rawDataFromRow.isTableEmpty())) {//some PK null , but other data present
+            	//continue; - need to throw exception as anyway the result will give a wrong impression
+            	//when any one table in result set misses PK column or has null value in PK column
+            	throw new RuntimeException("Table "+rawDataFromRow.getTableName()+" in query does not include Primary Key "+
+            			"column or has null value in it, can not proceed!");
             }
 
             String tableName = rawDataFromRow.getTableName();
             DataObject tableObject = registry.get(tableName, rawDataFromRow.getPrimaryKeyValues());
-            if (tableObject == null) {
+            if (tableObject == null
+            		&& !rawDataFromRow.hasNullPrimaryKey()) {//2nd check for null data in PK,
+            	//as TableData.addData() - hasValidPrimaryKey=false is commented for a reason
+            	//with this, DataObjs with null PK will not be added to registry and tableObjects
                 tableObject = doMaker.createAndAddDataObject(rawDataFromRow, resultMetadata);
 
                 if (this.logger.isDebugEnabled()) {
-                    this.logger.debug("Putting table " + tableName + " with PK " 
+                    this.logger.debug("Putting table " + tableName + " with PK "
                             + rawDataFromRow.getPrimaryKeyValues() + " into registry");
                 }
 
                 registry.put(tableName, rawDataFromRow.getPrimaryKeyValues(), tableObject);
             }
-            tableObjects.put(tableName, tableObject);
+            else{
+                if (this.logger.isDebugEnabled()) {
+                    this.logger.debug("Not Null tableObject or NULL PK");
+                }
+            }
+
+            if(tableObject != null){
+            	if (this.logger.isDebugEnabled()) {
+                    this.logger.debug("Do not allow any Null tableObject in tableObjects");
+                }
+            	tableObjects.put(tableName, tableObject);
+            }
         }
 
         tableObjects.processRelationships();

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java Tue Aug 14 02:53:41 2007
@@ -21,7 +21,10 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -78,20 +81,94 @@
             }
             table.addData(metadata.getColumnPropertyName(i), metadata.isPKColumn(i), data);
         }
-
+        
+        checkResultSetMissesPK();
     }
 
+    //get all table names involved in current result set
+    //can not use metadata.getAllTablePropertyNames()
+    //as it gives table names for all tables from Config
+    public Collection getAllTableNamesForRS(){
+    	Collection allTableNamesForRS = new HashSet();
+    	for (int i = 1; i <= metadata.getResultSetSize(); i++) {
+    		allTableNamesForRS.add(metadata.getTablePropertyName(i));
+    	}
+    	return allTableNamesForRS;
+    }
+    	
+    //case when result set omits PK column, take care of compound PKs too
+    public void checkResultSetMissesPK(){
+        boolean tableRSHasPK;
+        Collection allTableNames = getAllTableNamesForRS();
+        Iterator itr = allTableNames.iterator();
+        while(itr.hasNext()){
+        	tableRSHasPK = false;
+        	String currentTableName = (String)itr.next();
+        	HashSet pks = metadata.getAllPKsForTable(currentTableName);
+        	HashSet pksInRS = new HashSet();
+        	for(int j=1; j<=metadata.getResultSetSize(); j++){
+            	if(currentTableName.equals(metadata.getTablePropertyName(j)) &&
+            			metadata.isPKColumn(j) ){
+            		pksInRS.add(metadata.getColumnPropertyName(j));
+            	}
+            }
+        	
+        	//if pks null, means its classic case when all cols should be PKs
+        	if(pks == null){
+        		tableRSHasPK = true;
+        	}        	
+        	//case when there were cols in cfg but could not find any PK in it and no ID column in cfg 
+        	else if(pks != null && pks.size()==1 && pks.contains("")){
+        		tableRSHasPK = false;        		
+        	}        	
+        	else if(pks != null && pksInRS.size() == pks.size()){        		
+        		Iterator itr1 = pks.iterator();
+        		int indx=0;
+        		while(itr1.hasNext()){
+        			if(!pksInRS.contains((String)itr1.next())){
+        				indx++;			
+        			}
+        		}
+        		
+	        	if(indx == 0){
+	        		if (this.logger.isDebugEnabled()) {
+	        			this.logger.debug("has PK TRUE - matched");	
+	        		}	        		
+	        		tableRSHasPK = true;	
+	        	}else{
+	        		if (this.logger.isDebugEnabled()) {
+	        			this.logger.debug("has PK FALSE- mismatched");	
+	        		}	        		
+	        		tableRSHasPK = false;
+	        	}
+        	}
+        	else{
+        		if (this.logger.isDebugEnabled()) {
+        			this.logger.debug("has PK FALSE - rest all cases");	
+        		}
+        	}        	
+        	
+        	//Default is TRUE(from TableData), so consider only FALSE case
+            if(!tableRSHasPK){
+            	TableData table = getRawData(currentTableName);
+            	table.setValidPrimaryKey(tableRSHasPK);
+            }
+        }
+        
+        //for testing
+		if (this.logger.isDebugEnabled()) {
+	        for (int i = 1; i <= metadata.getResultSetSize(); i++) {
+	        	TableData table = getRawData(metadata.getTablePropertyName(i));
+	        	this.logger.debug("table "+table.getTableName()+" hasValidPK "+table.hasValidPrimaryKey());
+	        }			
+		}
+    }
+    
     public void processRecursiveRow(ResultSet rs) throws SQLException {
         this.allTableData = new ArrayList();
         int i = 1;
-        if (this.logger.isDebugEnabled()) {
-            this.logger.debug("");
-        }
 
         while (i <= metadata.getResultSetSize()) {
-            if (this.logger.isDebugEnabled()) {
-                this.logger.debug("");
-            }
             TableData table = new TableData(metadata.getTablePropertyName(i));
             this.allTableData.add(table);
 
@@ -117,6 +194,8 @@
                 i++;
             }
         }
+        
+        checkResultSetMissesPK();        
     }
 
     /**

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java Tue Aug 14 02:53:41 2007
@@ -36,6 +36,8 @@
 
     private boolean hasValidPrimaryKey = true;
 
+    private boolean hasNullPrimaryKey = false;
+    
     public TableData(String tableName) {
         if (this.logger.isDebugEnabled()) {
             this.logger.debug("Creating TableData for table " + tableName);
@@ -49,15 +51,21 @@
             this.logger.debug("Adding column " + columnName + " with value " + data);
         }
 
-        columnData.put(columnName, data);
+        if(data != null)
+        	columnData.put(columnName, data);
         if (isPrimaryKeyColumn) {
             if (data == null) {
                 if (this.logger.isDebugEnabled()) {
                     this.logger.debug("Column " + columnName + " is a primary key column and is null");
                 }
-                hasValidPrimaryKey = false;
+                //hasValidPrimaryKey = false; - if uncommented and JIRA-1464, RecursiveTests.testReadEngineParts() will fail
+            }
+            if(data != null){
+            	primaryKey.add(data);
+            }
+            else{
+            	hasNullPrimaryKey = true;
             }
-            primaryKey.add(data);
         }
     }
 
@@ -79,4 +87,16 @@
     public boolean hasValidPrimaryKey() {
         return hasValidPrimaryKey;
     }
+    
+    public void setValidPrimaryKey(boolean hasValidPK){
+    	this.hasValidPrimaryKey = hasValidPK;
+    }
+    
+    public boolean isTableEmpty(){
+    	return columnData.keySet().isEmpty();
+    }
+    
+    public boolean hasNullPrimaryKey(){
+    	return this.hasNullPrimaryKey;
+    }    
 }

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java Tue Aug 14 02:53:41 2007
@@ -23,6 +23,7 @@
 import org.apache.tuscany.das.rdb.Command;
 import org.apache.tuscany.das.rdb.DAS;
 import org.apache.tuscany.das.rdb.test.data.BookData;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
 import org.apache.tuscany.das.rdb.test.framework.DasTest;
 
 import commonj.sdo.DataObject;
@@ -33,6 +34,7 @@
     
         super.setUp();
         new BookData(getAutoConnection()).refresh();
+        new CustomerData(getAutoConnection()).refresh();
     }
 
     /**

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java Tue Aug 14 02:53:41 2007
@@ -52,9 +52,9 @@
         DAS das = DAS.FACTORY.createDAS(getConfig("companyMapping.xml"), getConnection());
 
         // Build the select command
-        Command selectCommand = das.createCommand("select COMPANY.NAME, " 
-                + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
-                + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
+        Command selectCommand = das.createCommand("select COMPANY.ID, COMPANY.NAME, " 
+                + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
+                + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
                 + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID");
 
         // Get the graph
@@ -77,9 +77,9 @@
         DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection());
         SDOUtil.registerStaticTypes(CompanyFactory.class);
         // Build the select command
-        Command selectCommand = das.createCommand("select COMPANY.NAME, " 
-                + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
-                + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
+        Command selectCommand = das.createCommand("select COMPANY.ID, COMPANY.NAME, " 
+                + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
+                + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
                 + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID");
 
         // Get the graph

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java Tue Aug 14 02:53:41 2007
@@ -28,6 +28,7 @@
 import org.apache.tuscany.das.rdb.test.customer.Customer;
 import org.apache.tuscany.das.rdb.test.customer.CustomerFactory;
 import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
 import org.apache.tuscany.das.rdb.test.framework.DasTest;
 import org.apache.tuscany.sdo.util.SDOUtil;
 
@@ -47,6 +48,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         new CustomerData(getAutoConnection()).refresh();
+        new OrderData(getAutoConnection()).refresh();
     }
 
     protected void tearDown() throws Exception {

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java Tue Aug 14 02:53:41 2007
@@ -77,9 +77,10 @@
         insert.execute();
 
         // Verify
-        Command select = das.createCommand("Select * from conmgt.serverstatus where statusid = 316405209");
+        Command select = das.createCommand("Select * from conmgt.serverstatus where statusid = 1");
         DataObject root = select.executeQuery();
-        assertEquals(1, root.getList("conmgt.serverstatus").size());
+                
+        assertEquals(1, root.getList("SERVERSTATUS").size());
 
     }
 
@@ -89,7 +90,9 @@
      * should throw a better error than NPE
      */
 
-    public void testReadUpdateWithNoPKColumns() throws Exception {
+    //now with JIRA-1464 , we will get exception in select itself , so can not reach upto
+    //applyChanges
+    /*public void testReadUpdateWithNoPKColumns() throws Exception {
         
         DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfig.xml"),getConnection());
         // Read a book instance
@@ -106,7 +109,7 @@
         } catch (NullPointerException ex) {
             fail("We should do better than an NPE");
         }
-    }
+    }*/
     
 
-}
\ No newline at end of file
+}

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java Tue Aug 14 02:53:41 2007
@@ -6,15 +6,15 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
- * under the License.    
+ * under the License.
  */
 package org.apache.tuscany.das.rdb.test;
 
@@ -23,7 +23,7 @@
 
 import org.apache.tuscany.das.rdb.Command;
 import org.apache.tuscany.das.rdb.DAS;
-import org.apache.tuscany.das.rdb.test.company.CompanyFactory;
+import org.apache.tuscany.das.rdb.test.companynoid.CompanynoidFactory;
 import org.apache.tuscany.das.rdb.test.customer.CustomerFactory;
 import org.apache.tuscany.das.rdb.test.data.BookData;
 import org.apache.tuscany.das.rdb.test.data.CompanyData;
@@ -103,7 +103,7 @@
             DAS.FACTORY.createDAS(getConfig("NonExistingFile.xml"));
             fail("Error should be thrown");
         } catch (RuntimeException e) {
-            assertEquals("Cannot load configuration from a null InputStream. Possibly caused " 
+            assertEquals("Cannot load configuration from a null InputStream. Possibly caused "
                     + "by an incorrect config xml file name", e.getMessage());
         }
     }
@@ -136,13 +136,13 @@
     }
 
     public void testMismatchedDataObjectModel() throws SQLException {
-        SDOUtil.registerStaticTypes(CompanyFactory.class);
-        DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection());
+        SDOUtil.registerStaticTypes(CompanynoidFactory.class);
+        DAS das = DAS.FACTORY.createDAS(getConfig("companynoidMappingWithConverters.xml"), getConnection());
         Command read = das.createCommand("select * from company");
         try {
             read.executeQuery();
         } catch (RuntimeException ex) {
-            assertEquals("Type CompanyType does not contain a property named ID", ex.getMessage());
+            assertEquals("Type CompanynoidType does not contain a property named ID", ex.getMessage());
         }
     }
 

Added: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java?view=auto&rev=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java (added)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java Tue Aug 14 02:53:41 2007
@@ -0,0 +1,332 @@
+package org.apache.tuscany.das.rdb.test;
+
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.BookData;
+import org.apache.tuscany.das.rdb.test.data.DogData;
+import org.apache.tuscany.das.rdb.test.data.MultiSchemaData;
+import org.apache.tuscany.das.rdb.test.data.OrderDetailsData;
+import org.apache.tuscany.das.rdb.test.data.OrderDetailsDescriptionData;
+import org.apache.tuscany.das.rdb.test.data.OwnerData;
+import org.apache.tuscany.das.rdb.test.data.OwnerDogData;
+import org.apache.tuscany.das.rdb.test.data.PartData;
+import org.apache.tuscany.das.rdb.test.data.SingerData;
+import org.apache.tuscany.das.rdb.test.data.SongData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class MissingPKTests  extends DasTest {
+    protected void setUp() throws Exception {
+        super.setUp();
+        new PartData(getAutoConnection()).refresh();
+        new DogData(getAutoConnection()).refresh();
+        new OwnerData(getAutoConnection()).refresh();
+        new OwnerDogData(getAutoConnection()).refresh();
+        new OrderDetailsData(getAutoConnection()).refresh();
+        new OrderDetailsDescriptionData(getAutoConnection()).refresh(); 
+        new MultiSchemaData(getAutoConnection()).refresh();
+        new BookData(getAutoConnection()).refresh();
+        new SingerData(getAutoConnection()).refresh();
+        new SongData(getAutoConnection()).refresh();        
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    //join with both tables PKs present in SELECT, PK data in child is null
+    public void testNullDataInPK() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("testNullDataInPK");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}
+    }
+    
+    //join with both tables PKs present in SELECT, child row is complete null, outer join    
+    public void testOuterJoin() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("testOuterJoin");
+    	DataObject root = select.executeQuery();
+    	List singers = root.getList("SINGER");
+    	List songs = root.getList("SONG");//as there is no relationship (explicit/implicit)
+    	assertNotNull(singers);
+    	assertEquals(1, singers.size());
+    	assertNotNull(songs);
+    	assertEquals(0, songs.size());
+    }
+    
+    //join with both tables' PKs present in SELECT
+    public void test11() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("test11");
+    	DataObject root = select.executeQuery();
+    	List owners = root.getList("OWNER");
+    	List dogs = root.getList("DOG");//as there is no relationship (explicit/implicit)
+    	assertNotNull(owners);
+    	assertNotNull(dogs);
+    	for(int i=0; i<owners.size(); i++){
+    		DataObject dobj = (DataObject)owners.get(i);
+    	}
+    	assertEquals(3, owners.size());
+    	assertEquals(3, dogs.size());
+    }
+    
+    //join with parent table's PK missing in SELECT
+    public void test22() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("test22");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}    	
+    }
+    
+    //join with child table's PK missing in SELECT
+    public void test33() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("test33");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}       
+    }
+    
+    //join with both tables' PK missing in SELECT
+    public void test44() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("test44");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}        
+    }
+    
+    //join with both tables' PK present in SELECT (use relationship)    
+    public void test11_rel() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("test11");
+    	DataObject root = select.executeQuery();
+    	List owners = root.getList("OWNER");
+    	assertNotNull(owners);
+    	assertEquals(3, owners.size());
+    	
+    	if(owners != null){
+    		for(int i=0; i<owners.size(); i++){        		
+    			List dogs = ((DataObject)owners.get(i)).getList("owns"); //use relationship
+    	    	assertNotNull(dogs);
+    	    	
+    	    	if( (((DataObject)owners.get(i)).getInt("ID") == 1 ) &&
+    	    			dogs.size()==1){
+    	    		assertTrue(true);//expected
+    	    	}
+    	    	
+    	    	if( (((DataObject)owners.get(i)).getInt("ID") == 2 ) &&
+    	    			dogs.size()==1){
+    	    		assertTrue(true);//expected
+    	    	}
+    	    	
+    	    	if( (((DataObject)owners.get(i)).getInt("ID") == 3 ) &&
+    	    			dogs.size()==1){
+    	    		assertTrue(true);//expected
+    	    	}    	    	
+    		}
+    	}
+    }
+    
+    //join with parent table's PK missing in SELECT (use relationship)    
+    public void test22_rel() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("test22");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}
+    }
+    
+    //join with child table's PK missing in SELECT (use relationship)    
+    public void test33_rel() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("test33");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}
+    }
+    
+    //join with both tables' PK missing in SELECT (use relationship)    
+    public void test44_rel() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("test44");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}
+    }
+    
+    public void testCompoundPks() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("compound_pks");
+    	DataObject root = select.executeQuery();
+    	assertEquals(4, root.getList("ORDERDETAILS").size());
+    }
+    
+    public void testCompoundPksFail() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("compound_pks_fail");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}   
+    }
+    
+    public void testCompoundPksJoin() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("compound_pks_join");
+    	DataObject root = select.executeQuery();
+    	List ordDetList = root.getList("ORDERDETAILS");
+    	assertEquals(4, ordDetList.size());
+    	for(int i=0; i<ordDetList.size(); i++){
+    		DataObject curDO = (DataObject)ordDetList.get(i);
+    		List ordDetDescList = curDO.getList("orderDetailsDesc");
+    		if(curDO.getInt("ORDERID")==1 && curDO.getInt("PRODUCTID")==1 && ordDetDescList.size()==2){
+    			assertTrue(true);//expected
+    		}
+    		
+    		if(curDO.getInt("ORDERID")==1 && curDO.getInt("PRODUCTID")==2 && ordDetDescList.size()==2){
+    			assertTrue(true);//expected
+    		}
+    		
+    		if(curDO.getInt("ORDERID")==2 && curDO.getInt("PRODUCTID")==1 && ordDetDescList.size()==1){
+    			assertTrue(true);//expected
+    		}
+    		
+    		if(curDO.getInt("ORDERID")==2 && curDO.getInt("PRODUCTID")==2 && ordDetDescList.size()==1){
+    			assertTrue(true);//expected
+    		}    		
+    	}
+    }
+    
+    public void testCompoundPksJoinFail() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection());
+    	Command select = das.getCommand("compound_pks_join_fail");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}    	
+    }
+    
+    //case when no PK defined in Config but column ID is there in table and is not in SELECT clause
+    //convention over configuration should assume it as PK and fail select
+    public void testPartFail() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("testPartFail");
+    	try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}
+    }
+    
+    public void testMultiSchemaPKMiss() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig14.xml"), getConnection());
+
+    	//Explicit compound key relationship between DASTEST1.ORDERDETAILS and DASTEST3.ORDERDETAILSDESC
+    	//ORDERID <-> ORDERID, PRODUCTID<->PRODUCTID
+    	// Read some order details and related order details descs
+        Command select = das
+                .createCommand("SELECT DASTEST1.ORDERDETAILS.ORDERID, DASTEST1.ORDERDETAILS.PRODUCTID," +
+                		"DASTEST3.ORDERDETAILSDESC.ORDERID FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " +
+                		" ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " +
+                		" AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID");
+
+        try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	} 
+    }
+    
+    public void testTypePropsDifferent() throws Exception {
+    	DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection());
+    	Command select = das.getCommand("get all books");
+        try{
+    		select.executeQuery();
+    		fail("Expected exception");
+    	}catch(RuntimeException e){
+    		if(e.getMessage().
+    				indexOf("in query does not include Primary Key "+
+    						"column or has null value in it, can not proceed!") >0){
+    			assertTrue(true);//expected failure
+    		}
+    	}     	
+    }
+}

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java Tue Aug 14 02:53:41 2007
@@ -24,6 +24,8 @@
 import org.apache.tuscany.das.rdb.config.Table;
 import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
 import org.apache.tuscany.das.rdb.impl.ReadCommandImpl;
+import org.apache.tuscany.das.rdb.test.customer.CustomerFactory;
+import org.apache.tuscany.sdo.util.SDOUtil;
 
 public class ReadCustomersStaticTypesCommand extends ReadCommandImpl {
 
@@ -51,6 +53,7 @@
         CONFIG.getTable().add(t);
 
         CONFIG.setDataObjectModel("http:///org.apache.tuscany.das.rdb.test/customer.xsd");
+        SDOUtil.registerStaticTypes(CustomerFactory.class);
     }
 
     public ReadCustomersStaticTypesCommand() {

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java Tue Aug 14 02:53:41 2007
@@ -26,12 +26,12 @@
 
 public class DepartmentData extends TestDataWithExplicitColumns {
 
-    private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR};
+    private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER};
 
-    private static Object[][] deptData = {{"Advanced Technologies", "NY", "123" },
-                                          {"New Technologies", "CA", "125" }};
+    private static Object[][] deptData = {{"Advanced Technologies", "NY", "123", new Integer(1) },
+                                          {"New Technologies", "CA", "125", new Integer(2) }};
 
-    private static String[] deptColumns = {"NAME", "LOCATION", "DEPNUMBER"};
+    private static String[] deptColumns = {"NAME", "LOCATION", "DEPNUMBER", "COMPANYID"};
 
     public DepartmentData(Connection connection) {
         super(connection, deptData, deptColumns, columnTypes);

Added: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java?view=auto&rev=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java (added)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java Tue Aug 14 02:53:41 2007
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+public class SingerData extends TestDataWithExplicitColumns {
+    // CREATE TABLE SINGER (ID INT , NAME VARCHAR(20))
+
+    private static int[] singerTypes = {Types.INTEGER, Types.VARCHAR};
+
+    private static Object[][] singerData = {{new Integer(1), "John"},
+        {new Integer(2), "Jane"}, {new Integer(3), "Lata"}};
+
+    private static String[] singerColumns = {"ID", "NAME"};
+
+    public SingerData(Connection connection) {
+        super(connection, singerData, singerColumns, singerTypes);
+    }
+
+    public String getTableName() {
+        return "SINGER";
+    }
+}
+

Added: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java?view=auto&rev=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java (added)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java Tue Aug 14 02:53:41 2007
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+public class SongData extends TestDataWithExplicitColumns {
+    // CREATE TABLE SONG (ID INT , TITLE VARCHAR(20), SINGERID INT)
+
+    private static int[] songTypes = {Types.INTEGER, Types.VARCHAR, Types.INTEGER};
+
+    private static Object[][] songData = {{null, "ABCD", new Integer(1)},
+        {new Integer(20), "Lamb", new Integer(1)},
+        {new Integer(30), "La ra ra", new Integer(2)}};
+
+    private static String[] songColumns = {"ID", "TITLE", "SINGERID"};
+
+    public SongData(Connection connection) {
+        super(connection, songData, songColumns, songTypes);
+    }
+
+    public String getTableName() {
+        return "SONG";
+    }
+}
+

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java Tue Aug 14 02:53:41 2007
@@ -162,7 +162,9 @@
             "DROP TABLE DASTEST2.ACCOUNT",
             "DROP TABLE DASTEST3.CUSTORDER",
             "DROP TABLE DASTEST3.ORDERDETAILSDESC", "DROP TABLE DASTEST1.ORDERDETAILS",
-            "DROP TABLE DASTEST1.EMPLOYEE"
+            "DROP TABLE DASTEST1.EMPLOYEE",
+            "DROP TABLE SINGER",
+            "DROP TABLE SONG"            
         };
 
         for (int i = 0; i < statements.length; i++) {
@@ -268,6 +270,8 @@
             s.execute(getCreateDASTEST1OrderDetails());
             s.execute(getCreateDASTEST3OrderDetailsDesc());            
             //JIRA-952 end
+            s.execute(getCreateSinger());
+            s.execute(getCreateSong());            
         } catch (SQLException e) {
             throw new RuntimeException(e);
         }
@@ -484,7 +488,17 @@
     }
     //JIRA-952 end
     // /////////////////
-
+    protected String getCreateSinger() {
+    	return "CREATE TABLE SINGER ("+ getIntegerColumn("ID") + " NOT NULL, " +
+    		getStringColumn("NAME", 20) +" )";
+    }
+    
+    protected String getCreateSong() {
+    	return "CREATE TABLE SONG ("+ getIntegerColumn("ID") + " , " +//" NOT NULL, " +
+    		getStringColumn("TITLE", 20) + ", "+
+    		getIntegerColumn("SINGERID") + " )";
+    }
+    
     protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) {
         StringBuffer buffer = new StringBuffer();
         buffer.append("CONSTRAINT FK1 FOREIGN KEY (");

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java Tue Aug 14 02:53:41 2007
@@ -38,6 +38,7 @@
 import org.apache.tuscany.das.rdb.test.GraphMergeTests;
 import org.apache.tuscany.das.rdb.test.ImpliedRelationshipTests;
 import org.apache.tuscany.das.rdb.test.KennelTests;
+import org.apache.tuscany.das.rdb.test.MissingPKTests;
 import org.apache.tuscany.das.rdb.test.MultiSchemaTests;
 import org.apache.tuscany.das.rdb.test.OCCTests;
 import org.apache.tuscany.das.rdb.test.OneToOneRelationshipTests;
@@ -109,6 +110,7 @@
         
         suite.addTest(new TestSuite(TransactionTests.class));
         suite.addTest(new TestSuite(MultiSchemaTests.class));
+        suite.addTest(new TestSuite(MissingPKTests.class));
     
         suite.addTest(new TestSuite(DynamicResultDescriptorTests.class));
         //$JUnit-END$

Added: incubator/tuscany/java/das/rdb/src/test/resources/MissingPK.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/MissingPK.xml?view=auto&rev=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/resources/MissingPK.xml (added)
+++ incubator/tuscany/java/das/rdb/src/test/resources/MissingPK.xml Tue Aug 14 02:53:41 2007
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd"> 
+  <Command name="testNullDataInPK" SQL="SELECT SINGER.ID, SINGER.NAME, SONG.ID, SONG.TITLE FROM SINGER, SONG WHERE SINGER.ID = SONG.SINGERID" kind="Select"/>
+  <Command name="testOuterJoin" SQL="SELECT SINGER.ID, SINGER.NAME, SONG.ID, SONG.TITLE FROM SINGER LEFT OUTER JOIN SONG ON SINGER.ID = SONG.SINGERID WHERE SINGER.ID = 3" kind="Select"/>
+
+  <Table tableName="SINGER">
+    <Column columnName="ID" primaryKey="true"/>
+  </Table>
+  
+  <Table tableName="SONG">
+    <Column columnName="ID" primaryKey="true" />
+  </Table>
+  
+  <Command name="test11" SQL="SELECT OWNER.ID, OWNER.NAME, DOG.ID, DOG.NAME  FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+  <Command name="test22" SQL="SELECT OWNER.ID, OWNER.NAME,  DOG.NAME FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+  <Command name="test33" SQL="SELECT OWNER.NAME, DOG.ID, DOG.NAME FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+  <Command name="test44" SQL="SELECT OWNER.NAME, DOG.NAME FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+
+  <Table tableName="OWNER">
+    <Column columnName="ID" primaryKey="true"/>
+  </Table>
+  
+  <Table tableName="DOG">
+    <Column columnName="ID" primaryKey="true" />
+  </Table>
+
+ <Command name="testPartFail" SQL="SELECT PART.QUANTITY FROM PART" kind="Select"/>
+  
+ <Table tableName="PART">
+    <Column columnName="ID"/>
+  </Table>  
+    
+  <Command name="get all books" SQL="SELECT AUTHOR FROM BOOK" kind="Select"/>
+  
+	<Table tableName="BOOK" typeName="BookInfo">
+        <Column columnName="BOOK_ID" propertyName="BookID" primaryKey="true"/>
+        <Column columnName="AUTHOR" propertyName="Writer"/>
+	    <Column columnName="OCC" collision="true"/>
+    </Table>
+      
+</Config>

Added: incubator/tuscany/java/das/rdb/src/test/resources/MissingPKREL.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/MissingPKREL.xml?view=auto&rev=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/resources/MissingPKREL.xml (added)
+++ incubator/tuscany/java/das/rdb/src/test/resources/MissingPKREL.xml Tue Aug 14 02:53:41 2007
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd"> 
+  <Command name="test11" SQL="SELECT OWNER.ID, OWNER.NAME, DOG.ID, DOG.NAME FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+  <Command name="test22" SQL="SELECT OWNER.ID, OWNER.NAME,  DOG.NAME FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+  <Command name="test33" SQL="SELECT OWNER.NAME, DOG.ID, DOG.NAME FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+  <Command name="test44" SQL="SELECT OWNER.NAME, DOG.NAME FROM OWNER, DOG WHERE OWNER.ID = DOG.OWNER_ID" kind="Select"/>
+
+  <Table tableName="OWNER">
+    <Column columnName="ID" primaryKey="true"/>
+  </Table>
+  
+  <Table tableName="DOG">
+    <Column columnName="ID" primaryKey="true" />
+  </Table>
+
+  <Relationship name="owns" primaryKeyTable="OWNER" foreignKeyTable="DOG" many="true">
+     <KeyPair primaryKeyColumn="ID" foreignKeyColumn="OWNER_ID"/>
+  </Relationship>	
+
+  <Command name="compound_pks" SQL="SELECT ORDERDETAILS.ORDERID, ORDERDETAILS.PRODUCTID FROM ORDERDETAILS" kind="Select"/>
+  <Command name="compound_pks_fail" SQL="SELECT ORDERDETAILS.ORDERID FROM ORDERDETAILS" kind="Select"/>
+  <Command name="compound_pks_join" 
+  SQL="SELECT ORDERDETAILS.ORDERID, ORDERDETAILS.PRODUCTID, ORDERDETAILSDESC.ID FROM ORDERDETAILS,ORDERDETAILSDESC WHERE ORDERDETAILS.ORDERID=ORDERDETAILSDESC.ORDERID AND ORDERDETAILS.PRODUCTID=ORDERDETAILSDESC.PRODUCTID"   
+  kind="Select">
+  </Command>
+  <Command name="compound_pks_join_fail" 
+  SQL="SELECT ORDERDETAILS.ORDERID, ORDERDETAILSDESC.ID FROM ORDERDETAILS, ORDERDETAILSDESC WHERE ORDERDETAILS.ORDERID=ORDERDETAILSDESC.ORDERID AND ORDERDETAILS.PRODUCTID=ORDERDETAILSDESC.PRODUCTID"   
+  kind="Select">  
+  </Command>
+	
+  <Table tableName="ORDERDETAILS">
+  	<Column columnName="PRODUCTID" primaryKey="true"/>
+ 	<Column columnName="ORDERID" primaryKey="true"/>
+  </Table>
+  
+  <Table tableName="ORDERDETAILSDESC">
+  	<Column columnName="ID" primaryKey="true"/>
+  </Table>
+     
+  <Relationship name="orderDetailsDesc" primaryKeyTable="ORDERDETAILS" foreignKeyTable="ORDERDETAILSDESC" many="true">
+     <KeyPair primaryKeyColumn="ORDERID" foreignKeyColumn="ORDERID"/>
+     <KeyPair primaryKeyColumn="PRODUCTID" foreignKeyColumn="PRODUCTID"/>
+  </Relationship>
+  
+</Config>

Modified: incubator/tuscany/java/das/rdb/src/test/resources/company.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/company.xsd?view=diff&rev=565681&r1=565680&r2=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/resources/company.xsd (original)
+++ incubator/tuscany/java/das/rdb/src/test/resources/company.xsd Tue Aug 14 02:53:41 2007
@@ -28,6 +28,7 @@
         <xsd:sequence>
           <xsd:element maxOccurs="unbounded" name="departments" type="company:DepartmentType"/>
         </xsd:sequence>
+        <xsd:attribute name="id" type="xsd:int"/>
         <xsd:attribute name="name" type="xsd:string"/>
         <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" ecore:reference="EmployeeType"/>
       </xsd:complexType>
@@ -36,13 +37,16 @@
         <xsd:sequence>
           <xsd:element maxOccurs="unbounded" name="employees" type="company:EmployeeType"/>
         </xsd:sequence>
+        <xsd:attribute name="id" type="xsd:int"/>        
         <xsd:attribute name="name" type="xsd:string"/>
         <xsd:attribute name="location" type="xsd:string"/>
         <xsd:attribute name="number" type="xsd:int"/>
       </xsd:complexType>
       <xsd:complexType name="EmployeeType">
+        <xsd:attribute name="id" type="xsd:int"/>      
         <xsd:attribute name="name" type="xsd:string"/>
         <xsd:attribute name="SN" type="xsd:ID"/>
         <xsd:attribute name="manager" type="xsd:boolean"/>
       </xsd:complexType>
     </xsd:schema>
+

Added: incubator/tuscany/java/das/rdb/src/test/resources/companynoid.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/companynoid.xsd?view=auto&rev=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/resources/companynoid.xsd (added)
+++ incubator/tuscany/java/das/rdb/src/test/resources/companynoid.xsd Tue Aug 14 02:53:41 2007
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<xsd:schema targetNamespace="org.apache.tuscany.das.rdb.test/companynoid.xsd" 
+	xmlns:companynoid="org.apache.tuscany.das.rdb.test/companynoid.xsd" 
+		xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+		xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">		
+	
+      <xsd:element name="companynoid" type="companynoid:CompanynoidType"/>
+      
+      <xsd:complexType name="CompanynoidType">
+        <xsd:sequence>
+          <xsd:element maxOccurs="unbounded" name="departmentsnoid" type="companynoid:DepartmentnoidType"/>
+        </xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string"/>
+        <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" ecore:reference="EmployeenoidType"/>
+      </xsd:complexType>
+      
+      <xsd:complexType name="DepartmentnoidType">
+        <xsd:sequence>
+          <xsd:element maxOccurs="unbounded" name="employees" type="companynoid:EmployeenoidType"/>
+        </xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string"/>
+        <xsd:attribute name="location" type="xsd:string"/>
+        <xsd:attribute name="number" type="xsd:int"/>
+      </xsd:complexType>
+      <xsd:complexType name="EmployeenoidType">
+        <xsd:attribute name="id" type="xsd:int"/>      
+        <xsd:attribute name="name" type="xsd:string"/>
+        <xsd:attribute name="SN" type="xsd:ID"/>
+        <xsd:attribute name="manager" type="xsd:boolean"/>
+      </xsd:complexType>
+</xsd:schema>

Added: incubator/tuscany/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml?view=auto&rev=565681
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml (added)
+++ incubator/tuscany/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml Tue Aug 14 02:53:41 2007
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd" dataObjectModel="org.apache.tuscany.das.rdb.test/companynoid.xsd">
+  
+  <Table tableName="COMPANY" typeName="CompanynoidType">
+    <Column columnName="ID" primaryKey="true"/>
+  </Table>
+  
+  <Table tableName="DEPARTMENT" typeName="DepartmentnoidType">
+    <Column columnName="ID" primaryKey="true"/>
+    <Column columnName="DEPNUMBER" propertyName="NUMBER" converterClassName="org.apache.tuscany.das.rdb.test.mappings.StringToIntegerConverter"/>
+  </Table>
+
+  <Table tableName="EMPLOYEE" typeName="EmployeenoidType">
+  	  <Column columnName="ID" primaryKey="true"/>
+  	  <Column columnName="MANAGER" converterClassName="org.apache.tuscany.das.rdb.test.mappings.IntegerToBooleanConverter"/>
+  </Table>	
+	
+  <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
+     <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
+  </Relationship>	
+
+  <Relationship name="employees" primaryKeyTable="DEPARTMENT" foreignKeyTable="EMPLOYEE" many="true">
+     <KeyPair primaryKeyColumn="ID" foreignKeyColumn="DEPARTMENTID"/>
+  </Relationship>	
+	
+</Config>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message