cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r719852 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle: OracleAdapter.java OracleUUIDType.java
Date Sat, 22 Nov 2008 14:06:16 GMT
Author: aadamchik
Date: Sat Nov 22 06:06:15 2008
New Revision: 719852

URL: http://svn.apache.org/viewvc?rev=719852&view=rev
Log:
UUID handling on Oracle

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleUUIDType.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java?rev=719852&r1=719851&r2=719852&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java
Sat Nov 22 06:06:15 2008
@@ -220,6 +220,7 @@
         map.registerType(new OracleDoubleType());
 
         map.registerType(new OracleBooleanType());
+        map.registerType(new OracleUUIDType());
     }
 
     /**

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleUUIDType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleUUIDType.java?rev=719852&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleUUIDType.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleUUIDType.java
Sat Nov 22 06:06:15 2008
@@ -0,0 +1,51 @@
+/*****************************************************************
+ *   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.cayenne.dba.oracle;
+
+import java.sql.PreparedStatement;
+import java.util.UUID;
+
+import org.apache.cayenne.access.types.UUIDType;
+
+/**
+ * @since 3.0
+ */
+class OracleUUIDType extends UUIDType {
+
+    @Override
+    public void setJdbcObject(
+            PreparedStatement statement,
+            Object value,
+            int pos,
+            int type,
+            int scale) throws Exception {
+
+        // Oracle requires explicit UUID to string conversion
+        if (value == null) {
+            statement.setNull(pos, type);
+        }
+        else if (value instanceof UUID) {
+            statement.setObject(pos, value.toString(), type);
+        }
+        else {
+            throw new IllegalArgumentException("Expected java.util.UUID, got "
+                    + value.getClass().getName());
+        }
+    }
+}



Mime
View raw message