You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2013/06/16 00:34:23 UTC

svn commit: r1493426 - in /cayenne/main/trunk: ./ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/ framework/cayenne-jdk1.5-u...

Author: aadamchik
Date: Sat Jun 15 22:34:23 2013
New Revision: 1493426

URL: http://svn.apache.org/r1493426
Log:
CAY-1836  Firebird Adapter

patch by      Miłosz Pigłas

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdMergerFactory.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdSniffer.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/org/apache/cayenne/dba/firebird/
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/org/apache/cayenne/dba/firebird/types.xml
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
    cayenne/main/trunk/pom.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java?rev=1493426&r1=1493425&r2=1493426&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java Sat Jun 15 22:34:23 2013
@@ -66,6 +66,7 @@ import org.apache.cayenne.configuration.
 import org.apache.cayenne.configuration.XMLDataMapLoader;
 import org.apache.cayenne.dba.db2.DB2Sniffer;
 import org.apache.cayenne.dba.derby.DerbySniffer;
+import org.apache.cayenne.dba.firebird.FirebirdSniffer;
 import org.apache.cayenne.dba.frontbase.FrontBaseSniffer;
 import org.apache.cayenne.dba.h2.H2Sniffer;
 import org.apache.cayenne.dba.hsqldb.HSQLDBSniffer;
@@ -135,6 +136,7 @@ public class ServerModule implements Mod
         // add their own to install custom adapters automatically
         binder
                 .bindList(Constants.SERVER_ADAPTER_DETECTORS_LIST)
+                .add(new FirebirdSniffer(objectFactory))
                 .add(new OpenBaseSniffer(objectFactory))
                 .add(new FrontBaseSniffer(objectFactory))
                 .add(new IngresSniffer(objectFactory))

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java?rev=1493426&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java Sat Jun 15 22:34:23 2013
@@ -0,0 +1,130 @@
+/*****************************************************************
+ *   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.firebird;
+
+import java.sql.Types;
+import java.util.List;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.access.types.ByteArrayType;
+import org.apache.cayenne.access.types.CharType;
+import org.apache.cayenne.access.types.ExtendedType;
+import org.apache.cayenne.access.types.ExtendedTypeFactory;
+import org.apache.cayenne.access.types.ExtendedTypeMap;
+import org.apache.cayenne.access.trans.QualifierTranslator;
+import org.apache.cayenne.access.trans.QueryAssembler;
+import org.apache.cayenne.configuration.Constants;
+import org.apache.cayenne.configuration.RuntimeProperties;
+import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.dba.TypesMapping;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.DbRelationship;
+
+/**
+ * DbAdapter implementation for <a href="http://www.firebirdsql.org">FirebirdSQL
+ * RDBMS </a>. Sample connection settings to use with Firebird are shown
+ * below:
+ * 
+ * <pre>
+ *      firebird.cayenne.adapter = org.apache.cayenne.dba.firebird.FirebirdAdapter
+ *      firebird.jdbc.username = test
+ *      firebird.jdbc.password = secret
+ *      firebird.jdbc.url = jdbc:firebirdsql:localhost:/home/firebird/test.fdb  
+ *      firebird.jdbc.driver = org.firebirdsql.jdbc.FBDriver
+ * </pre>
+ */
+public class FirebirdAdapter extends JdbcAdapter {
+
+    public FirebirdAdapter(@Inject RuntimeProperties runtimeProperties,
+            @Inject(Constants.SERVER_DEFAULT_TYPES_LIST) List<ExtendedType> defaultExtendedTypes,
+            @Inject(Constants.SERVER_USER_TYPES_LIST) List<ExtendedType> userExtendedTypes,
+            @Inject(Constants.SERVER_TYPE_FACTORIES_LIST) List<ExtendedTypeFactory> extendedTypeFactories) {
+        super(
+                runtimeProperties,
+                defaultExtendedTypes,
+                userExtendedTypes,
+                extendedTypeFactories);
+	    setSupportsBatchUpdates(true);
+    }
+    
+    protected void configureExtendedTypes(ExtendedTypeMap map) {
+        super.configureExtendedTypes(map);
+        // handling internaly binary types as blobs or clobs generates exceptions
+        // Blob.length() and Clob.length() methods are optional (http://docs.oracle.com/javase/7/docs/api/java/sql/Clob.html#length())
+        // and firebird driver doesn't support them.
+        map.registerType(new ByteArrayType(true, false));
+        map.registerType(new CharType(true, false));
+        
+    }
+    
+    public FirebirdMergerFactory mergerFactory() {
+        return new FirebirdMergerFactory();
+    }
+    
+    public void createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) {
+
+        String[] types = externalTypesForJdbcType(column.getType());
+        if (types == null || types.length == 0) {
+            String entityName = column.getEntity() != null ? ((DbEntity) column.getEntity()).getFullyQualifiedName()
+                    : "<null>";
+            throw new CayenneRuntimeException("Undefined type for attribute '" + entityName + "." + column.getName()
+                    + "': " + column.getType());
+        }
+
+        String type = types[0];
+        sqlBuffer.append(quotingStrategy.quotedName(column));
+        sqlBuffer.append(' ').append(type);
+
+        // append size and precision (if applicable)s
+        if (TypesMapping.supportsLength(column.getType())) {
+            int len = column.getMaxLength();
+
+            int scale = (TypesMapping.isDecimal(column.getType()) && column.getType() != Types.FLOAT) ? column
+                    .getScale() : -1;
+
+            // sanity check
+            if (scale > len) {
+                scale = -1;
+            }
+
+            if (len > 0) {
+                sqlBuffer.append('(').append(len);
+
+                if (scale >= 0) {
+                    sqlBuffer.append(", ").append(scale);
+                }
+
+                sqlBuffer.append(')');
+            }
+        }
+
+        sqlBuffer.append(column.isMandatory() ? " NOT NULL" : "");
+    }
+    
+    @Override
+    public QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler) {
+        QualifierTranslator translator = new FirebirdQualifierTranslator(queryAssembler);
+        return translator;
+    }
+
+
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdMergerFactory.java?rev=1493426&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdMergerFactory.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdMergerFactory.java Sat Jun 15 22:34:23 2013
@@ -0,0 +1,93 @@
+/*****************************************************************
+ *   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.firebird;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.QuotingStrategy;
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.merge.MergerFactory;
+import org.apache.cayenne.merge.MergerToken;
+import org.apache.cayenne.merge.AddColumnToDb;
+import org.apache.cayenne.merge.DropColumnToDb;
+import org.apache.cayenne.merge.SetNotNullToDb;
+import org.apache.cayenne.merge.SetAllowNullToDb;
+
+public class FirebirdMergerFactory extends MergerFactory {
+    
+    public MergerToken createDropColumnToDb(DbEntity entity, DbAttribute column) {
+        return new DropColumnToDb(entity, column) {
+            public List<String> createSql(DbAdapter adapter) {
+                QuotingStrategy quoting = adapter.getQuotingStrategy();
+                StringBuilder builder = new StringBuilder("ALTER TABLE ");
+                builder.append(quoting.quotedFullyQualifiedName(getEntity()));
+                builder.append(" DROP ").append(quoting.quotedName(getColumn()));
+                return Collections.singletonList(builder.toString());
+            }
+        };
+    }
+    
+    @Override
+    public MergerToken createSetNotNullToDb(DbEntity entity, DbAttribute column) {
+        return new SetNotNullToDb(entity, column) {
+            public List<String> createSql(DbAdapter adapter) {
+                QuotingStrategy context = adapter.getQuotingStrategy();
+                String entityName = context.quotedFullyQualifiedName(getEntity()) ;
+                String columnName = context.quotedName(getColumn());
+                // Firebird doesn't support ALTER TABLE table_name ALTER column_name SET NOT NULL
+                // but this might be achived by modyfication of system tables 
+                return Collections.singletonList(String.format("UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = 1 "+ 
+                "WHERE RDB$FIELD_NAME = '%s' AND RDB$RELATION_NAME = '%s'", columnName, entityName));
+            }
+        };
+    }
+    
+    @Override
+    public MergerToken createSetAllowNullToDb(DbEntity entity, DbAttribute column) {
+        return new SetAllowNullToDb(entity, column) {
+            public List<String> createSql(DbAdapter adapter) {
+                QuotingStrategy context = adapter.getQuotingStrategy();
+                String entityName = context.quotedFullyQualifiedName(getEntity()) ;
+                String columnName = context.quotedName(getColumn()); 
+                // Firebird doesn't support ALTER TABLE table_name ALTER column_name DROP NOT NULL
+                // but this might be achived by modyfication system tables 
+                return Collections.singletonList(String.format("UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL "+
+                " WHERE RDB$FIELD_NAME = '%s' AND RDB$RELATION_NAME = '%s'", columnName, entityName));
+            }
+        };
+    }
+    
+    
+    public MergerToken createAddColumnToDb(DbEntity entity, DbAttribute column) {
+        return new AddColumnToDb(entity, column) {
+            protected void appendPrefix(StringBuffer sqlBuffer, QuotingStrategy context) {
+                sqlBuffer.append("ALTER TABLE ");
+                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
+                sqlBuffer.append(" ADD ");
+                sqlBuffer.append(context.quotedName(getColumn()));
+                sqlBuffer.append(" ");
+            }
+        };
+    }
+
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java?rev=1493426&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java Sat Jun 15 22:34:23 2013
@@ -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.cayenne.dba.firebird;
+
+import java.io.IOException;
+
+import org.apache.cayenne.access.trans.QualifierTranslator;
+import org.apache.cayenne.access.trans.QueryAssembler;
+import org.apache.cayenne.dba.oracle.OracleQualifierTranslator;
+import org.apache.cayenne.exp.Expression;
+
+public class FirebirdQualifierTranslator extends QualifierTranslator {
+    public FirebirdQualifierTranslator(QueryAssembler queryAssembler) {
+        super(queryAssembler);
+    }
+
+    @Override
+    protected void doAppendPart(Expression rootNode) throws IOException {
+        if (rootNode == null) {
+            return;
+        }
+        // IN statements with more than 1500 values are denied in Firebird
+        // so we need to split one big statement on few smaller ones
+        rootNode = rootNode.transform(new OracleQualifierTranslator.INTrimmer());
+        rootNode.traverse(this);
+    }
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdSniffer.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdSniffer.java?rev=1493426&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdSniffer.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/firebird/FirebirdSniffer.java Sat Jun 15 22:34:23 2013
@@ -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.cayenne.dba.firebird;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+import org.apache.cayenne.configuration.server.DbAdapterDetector;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.di.AdhocObjectFactory;
+import org.apache.cayenne.di.Inject;
+
+public class FirebirdSniffer implements DbAdapterDetector {
+    protected AdhocObjectFactory objectFactory;
+
+    public FirebirdSniffer(@Inject AdhocObjectFactory objectFactory) {
+        this.objectFactory = objectFactory;
+    }
+
+    public DbAdapter createAdapter(DatabaseMetaData md) throws SQLException {
+        String dbName = md.getDatabaseProductName();
+        return dbName != null && dbName.toUpperCase().contains("FIREBIRD")
+                ? (DbAdapter) objectFactory.newInstance(
+                        DbAdapter.class,
+                        FirebirdAdapter.class.getName()) : null;
+    }
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/org/apache/cayenne/dba/firebird/types.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/org/apache/cayenne/dba/firebird/types.xml?rev=1493426&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/org/apache/cayenne/dba/firebird/types.xml (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/org/apache/cayenne/dba/firebird/types.xml Sat Jun 15 22:34:23 2013
@@ -0,0 +1,114 @@
+<?xml version="1.0"?>
+
+<!--
+   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.
+-->
+
+<!-- 
+Firebird types mapping
+
+Useful url:
+http://db.apache.org/ddlutils/databases/firebird.html
+-->
+
+<types>
+   <jdbc-type name="ARRAY">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="BIGINT">
+       <db-type name="BIGINT"/>
+   </jdbc-type>
+   <jdbc-type name="BINARY">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="BIT">
+       <db-type name="SMALLINT"/>
+   </jdbc-type>
+   <jdbc-type name="BLOB">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="BOOLEAN">
+       <db-type name="SMALLINT"/> <!-- firebird doesn't support BOOLEAN type so it is emulated with smallint -->
+   </jdbc-type>
+   <jdbc-type name="CHAR">
+       <db-type name="VARCHAR"/> <!-- LIKE operator doesn't work as expected for CHAR type -->
+   </jdbc-type>
+   <jdbc-type name="CLOB">
+       <db-type name="BLOB SUB_TYPE TEXT"/>
+   </jdbc-type>
+   <jdbc-type name="DATALINK">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="DATE">
+       <db-type name="DATE"/>
+   </jdbc-type>
+   <jdbc-type name="DECIMAL">
+       <db-type name="DECIMAL"/>
+   </jdbc-type>
+   <jdbc-type name="DOUBLE">
+       <db-type name="DOUBLE PRECISION"/>
+   </jdbc-type>
+   <jdbc-type name="FLOAT">
+       <db-type name="DOUBLE PRECISION"/>
+   </jdbc-type>
+   <jdbc-type name="INTEGER">
+       <db-type name="INTEGER"/>
+   </jdbc-type>
+   <jdbc-type name="JAVA_OBJECT">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="LONGVARBINARY">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="LONGVARCHAR">
+       <db-type name="BLOB SUB_TYPE TEXT"/>
+   </jdbc-type>
+   <jdbc-type name="NUMERIC">
+       <db-type name="DECIMAL"/>
+   </jdbc-type>
+   <jdbc-type name="OTHER">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="REAL">
+       <db-type name="REAL"/>
+   </jdbc-type>
+   <jdbc-type name="REF">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="SMALLINT">
+       <db-type name="SMALLINT"/>
+   </jdbc-type>
+   <jdbc-type name="STRUCT">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="TIME">
+       <db-type name="TIME"/>
+   </jdbc-type>
+   <jdbc-type name="TIMESTAMP">
+       <db-type name="TIMESTAMP"/>
+   </jdbc-type>
+   <jdbc-type name="TINYINT">
+       <db-type name="SMALLINT"/>
+   </jdbc-type>
+   <jdbc-type name="VARBINARY">
+       <db-type name="BLOB"/>
+   </jdbc-type>
+   <jdbc-type name="VARCHAR">
+       <db-type name="VARCHAR"/>
+   </jdbc-type>
+</types>

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java?rev=1493426&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java Sat Jun 15 22:34:23 2013
@@ -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.cayenne.unit;
+
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.map.DbEntity;
+
+public class FirebirdUnitDbAdapter extends UnitDbAdapter {
+
+    public FirebirdUnitDbAdapter(DbAdapter adapter) {
+        super(adapter);
+    }
+    
+    public boolean supportsBoolean() {
+        return true;
+    }
+    
+    public boolean supportsLobs() {
+        return true;
+    }
+    
+    public boolean supportsFKConstraints(DbEntity entity) {
+        return !entity.getName().contains("CLOB");
+    }
+    
+    public boolean supportsBinaryPK() {
+        return false;
+    }
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java?rev=1493426&r1=1493425&r2=1493426&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java Sat Jun 15 22:34:23 2013
@@ -59,6 +59,7 @@ import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.db2.DB2Adapter;
 import org.apache.cayenne.dba.derby.DerbyAdapter;
+import org.apache.cayenne.dba.firebird.FirebirdAdapter;
 import org.apache.cayenne.dba.frontbase.FrontBaseAdapter;
 import org.apache.cayenne.dba.h2.H2Adapter;
 import org.apache.cayenne.dba.hsqldb.HSQLDBAdapter;
@@ -82,6 +83,7 @@ import org.apache.cayenne.map.EntityReso
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.unit.DB2UnitDbAdapter;
 import org.apache.cayenne.unit.DerbyUnitDbAdapter;
+import org.apache.cayenne.unit.FirebirdUnitDbAdapter;
 import org.apache.cayenne.unit.FrontBaseUnitDbAdapter;
 import org.apache.cayenne.unit.H2UnitDbAdapter;
 import org.apache.cayenne.unit.HSQLDBUnitDbAdapter;
@@ -115,6 +117,8 @@ public class ServerCaseModule implements
         // inside ServerRuntimeProvider.
 
         binder.bindMap(UnitDbAdapterProvider.TEST_ADAPTERS_MAP).put(
+                FirebirdAdapter.class.getName(),
+                FirebirdUnitDbAdapter.class.getName()).put(
                 OracleAdapter.class.getName(),
                 OracleUnitDbAdapter.class.getName()).put(
                 DerbyAdapter.class.getName(),

Modified: cayenne/main/trunk/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/pom.xml?rev=1493426&r1=1493425&r2=1493426&view=diff
==============================================================================
--- cayenne/main/trunk/pom.xml (original)
+++ cayenne/main/trunk/pom.xml Sat Jun 15 22:34:23 2013
@@ -764,6 +764,23 @@
 			</activation>
 		</profile>
 		<profile>
+			<id>firebird</id>
+			<activation>
+				<property>
+					<name>cayenneTestConnection</name>
+					<value>firebird</value>
+				</property>
+			</activation>
+			<dependencies>
+				<dependency>
+					<groupId>org.firebirdsql.jdbc</groupId>
+					<artifactId>jaybird-jdk16</artifactId>
+					<version>2.2.3</version>
+					<scope>test</scope>
+				</dependency>
+			</dependencies>
+		</profile>
+		<profile>
 			<id>frontbase</id>
 			<activation>
 				<property>