openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dez...@apache.org
Subject svn commit: r793096 - in /openjpa/branches/1.1.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/meta/ openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/pe...
Date Fri, 10 Jul 2009 20:09:35 GMT
Author: dezzio
Date: Fri Jul 10 20:09:35 2009
New Revision: 793096

URL: http://svn.apache.org/viewvc?rev=793096&view=rev
Log:
OpenJPA-1002: Merged change 769505 from trunk.  Fix for range query with Oracle.

Added:
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/meta/TestRangeQuery.java
      - copied unchanged from r769505, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/meta/TestRangeQuery.java
Modified:
    openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/common/apps/META-INF/persistence.xml
  (contents, props changed)

Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=793096&r1=793095&r2=793096&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Fri Jul 10 20:09:35 2009
@@ -1675,14 +1675,14 @@
      *                  size clause will be inserted appropriately.   
      */
     protected String insertSize(String typeName, String size) {
-    	if (StringUtils.isEmpty(size)) {
+        if (StringUtils.isEmpty(size)) {
             int idx = typeName.indexOf("{0}");
             if (idx != -1) {
                 return typeName.substring(0, idx);
             }
             return typeName;
         }
-    	
+        
         int idx = typeName.indexOf("{0}");
         if (idx != -1) {
             // replace '{0}' with size
@@ -1831,7 +1831,7 @@
         from.append("(");
         from.append(toSelect(subSelect, null, subFrom, where,
             sel.getGrouping(), sel.getHaving(), null, sel.isDistinct(),
-            false, sel.getStartIndex(), sel.getEndIndex(), true));
+            false, sel.getStartIndex(), sel.getEndIndex(), true, sel));
         from.append(")");
         if (requiresAliasForSubselect)
             from.append(" ").append(Select.FROM_SELECT_ALIAS);
@@ -2318,11 +2318,11 @@
     /**
      * Combine the given components into a SELECT statement.
      */
-    public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch,
+    protected SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch,
         SQLBuffer from, SQLBuffer where, SQLBuffer group,
         SQLBuffer having, SQLBuffer order,
         boolean distinct, boolean forUpdate, long start, long end,
-        boolean subselect) {
+        boolean subselect, Select sel) {
         return toOperation(getSelectOperation(fetch), selects, from, where,
             group, having, order, distinct, start, end,
             getForUpdateClause(fetch, forUpdate, null), subselect);
@@ -2341,7 +2341,7 @@
     /**
      * Combine the given components into a SELECT statement.
      */
-    public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch,
+    protected SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch,
         SQLBuffer from, SQLBuffer where, SQLBuffer group,
         SQLBuffer having, SQLBuffer order,
         boolean distinct, boolean forUpdate, long start, long end,
@@ -3430,7 +3430,7 @@
     /**
      * Return the declaration SQL for the given unique constraint. This
      * method is used from within {@link #getCreateTableSQL}.
-     * Returns	<code>CONSTRAINT &lt;name&gt; UNIQUE (&lt;col list&gt;)</code>
+     * Returns    <code>CONSTRAINT &lt;name&gt; UNIQUE (&lt;col list&gt;)</code>
      * by default.
      */
     protected String getUniqueConstraintSQL(Unique unq) {
@@ -4090,23 +4090,23 @@
         InputStream stream = getClass().getResourceAsStream(rsrc);
         String dictionaryClassName = getClass().getName();
         if (stream == null) { // User supplied dictionary but no error codes xml
-        	stream = DBDictionary.class.getResourceAsStream(rsrc); // use default
-        	dictionaryClassName = getClass().getSuperclass().getName();
+            stream = DBDictionary.class.getResourceAsStream(rsrc); // use default
+            dictionaryClassName = getClass().getSuperclass().getName();
         }
         codeReader.parse(stream, dictionaryClassName, this);
     }
 
     public void addErrorCode(Integer errorType, String errorCode) {
-    	if (errorCode == null || errorCode.trim().length() == 0)
-    		return;
-		Set codes = (Set) sqlStateCodes.get(errorType);
-    	if (codes == null) {
-    		codes = new HashSet();
-    		codes.add(errorCode.trim());
-    		sqlStateCodes.put(errorType, codes);
-    	} else {
-    		codes.add(errorCode.trim());
-    	}
+        if (errorCode == null || errorCode.trim().length() == 0)
+            return;
+        Set codes = (Set) sqlStateCodes.get(errorType);
+        if (codes == null) {
+            codes = new HashSet();
+            codes.add(errorCode.trim());
+            sqlStateCodes.put(errorType, codes);
+        } else {
+            codes.add(errorCode.trim());
+        }
     }
     
     //////////////////////////////////////
@@ -4167,11 +4167,11 @@
      */
     public OpenJPAException newStoreException(String msg, SQLException[] causes,
         Object failed) {
-    	if (causes != null && causes.length > 0) {
-    		OpenJPAException ret = narrow(msg, causes[0]);
-    		ret.setFailedObject(failed).setNestedThrowables(causes);
-    		return ret;
-    	}
+        if (causes != null && causes.length > 0) {
+            OpenJPAException ret = narrow(msg, causes[0]);
+            ret.setFailedObject(failed).setNestedThrowables(causes);
+            return ret;
+        }
         return new StoreException(msg).setFailedObject(failed).
             setNestedThrowables(causes);
     }
@@ -4182,29 +4182,29 @@
      * Returns -1 if no matching code can be found.
      */
     OpenJPAException narrow(String msg, SQLException ex) {
-    	String errorState = ex.getSQLState();
-    	int errorType = StoreException.GENERAL;
-    	for (Iterator iter = sqlStateCodes.keySet().iterator(); iter.hasNext(); ) {
-        	Integer type = (Integer) iter.next();
-    		Set erroStates = (Set) sqlStateCodes.get(type);
-    		if (erroStates != null && erroStates.contains(errorState)) {
-    			errorType = type.intValue();
-    			break;
-    		}
-    	}
-    	switch (errorType) {
-	    	case StoreException.LOCK: 
-	            return new LockException(msg);
-	    	case StoreException.OBJECT_EXISTS:
-	            return new ObjectExistsException(msg);
-	    	case StoreException.OBJECT_NOT_FOUND:
-	            return new ObjectNotFoundException(msg);
-	    	case StoreException.OPTIMISTIC:
-	            return new OptimisticException(msg);
-	    	case StoreException.REFERENTIAL_INTEGRITY: 
-	            return new ReferentialIntegrityException(msg);
-	        default:
-	            return new StoreException(msg);
+        String errorState = ex.getSQLState();
+        int errorType = StoreException.GENERAL;
+        for (Iterator iter = sqlStateCodes.keySet().iterator(); iter.hasNext(); ) {
+            Integer type = (Integer) iter.next();
+            Set erroStates = (Set) sqlStateCodes.get(type);
+            if (erroStates != null && erroStates.contains(errorState)) {
+                errorType = type.intValue();
+                break;
+            }
+        }
+        switch (errorType) {
+            case StoreException.LOCK: 
+                return new LockException(msg);
+            case StoreException.OBJECT_EXISTS:
+                return new ObjectExistsException(msg);
+            case StoreException.OBJECT_NOT_FOUND:
+                return new ObjectNotFoundException(msg);
+            case StoreException.OPTIMISTIC:
+                return new OptimisticException(msg);
+            case StoreException.REFERENTIAL_INTEGRITY: 
+                return new ReferentialIntegrityException(msg);
+            default:
+                return new StoreException(msg);
         }
     }
 

Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java?rev=793096&r1=793095&r2=793096&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
(original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
Fri Jul 10 20:09:35 2009
@@ -357,7 +357,16 @@
         return buf;
     }
 
-    public SQLBuffer toSelect(SQLBuffer select, JDBCFetchConfiguration fetch,
+    protected SQLBuffer toSelect(SQLBuffer select, JDBCFetchConfiguration fetch,
+            SQLBuffer tables, SQLBuffer where, SQLBuffer group,
+            SQLBuffer having, SQLBuffer order,
+            boolean distinct, boolean forUpdate, long start, long end,
+            boolean subselect, Select sel) {
+        return toSelect(select, fetch, tables, where, group, having, order,
+                distinct, forUpdate, start, end, sel);
+    }
+
+    protected SQLBuffer toSelect(SQLBuffer select, JDBCFetchConfiguration fetch,
         SQLBuffer tables, SQLBuffer where, SQLBuffer group,
         SQLBuffer having, SQLBuffer order,
         boolean distinct, boolean forUpdate, long start, long end,

Modified: openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/common/apps/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/common/apps/META-INF/persistence.xml?rev=793096&r1=793095&r2=793096&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/common/apps/META-INF/persistence.xml
(original)
+++ openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/common/apps/META-INF/persistence.xml
Fri Jul 10 20:09:35 2009
@@ -1,43 +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.   
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
-    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
-  version="1.0">
-
-	<persistence-unit name="TestConv" transaction-type="RESOURCE_LOCAL">
-		<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.AutoIncrementPC1</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.AutoIncrementPC2</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.AutoIncrementPC3</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.ConstantJoinPC4</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.ConstantJoinPC5</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.CustomMappingPC</class>
-        <class>org.apache.openjpa.persistence.jdbc.common.apps.DFGTest</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.EagerPC</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.EagerPCSub</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC2</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC3</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC4</class>
-		<class>org.apache.openjpa.persistence.jdbc.common.apps.InvertA</class>
-        <class>org.apache.openjpa.persistence.jdbc.common.apps.InvertB</class>
-	</persistence-unit>
-</persistence>
+<!--
+ 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.   
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+  version="1.0">
+
+    <persistence-unit name="TestConv" transaction-type="RESOURCE_LOCAL">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.AutoIncrementPC1</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.AutoIncrementPC2</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.AutoIncrementPC3</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.ConstantJoinPC4</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.ConstantJoinPC5</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.CustomMappingPC</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.DFGTest</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.EagerPC</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.EagerPCSub</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC2</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC3</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.HelperPC4</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.InvertA</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.InvertB</class>
+        <class>org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC</class>
+    </persistence-unit>
+</persistence>

Propchange: openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/common/apps/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message