org.castor.cpa.persistence.sql.driver
Class InstantDBFactory

java.lang.Object
  extended by org.castor.cpa.persistence.sql.driver.BaseFactory
      extended by org.castor.cpa.persistence.sql.driver.GenericFactory
          extended by org.castor.cpa.persistence.sql.driver.InstantDBFactory
All Implemented Interfaces:
PersistenceFactory

public class InstantDBFactory
extends GenericFactory

Persistence factory for InstantDB database (http://instantdb.enhydra.org/ ).

Example database.xml file for JDO

   <database name="test" engine="instantdb" >
       <driver class-name="org.enhydra.instantdb.jdbc.idbDriver" 
               url="jdbc:idb:C:\\castor-0.8.8\\db\\test\\test.prp">
         <param name="user" value="" />
         <param name="password" value="" />
       </driver>
       <mapping href="mapping.xml" />
    </database>
  

Version:
1.0
Author:
I. Burak Ozyurt

Field Summary
static java.lang.String FACTORY_NAME
           
 
Constructor Summary
InstantDBFactory()
           
 
Method Summary
 java.lang.Class adjustSqlType(java.lang.Class sqlType)
          For NUMERIC type ResultSet.getObject() returns Double instead of BigDecimal for InstantDB.
 PersistenceQuery getCallQuery(java.lang.String call, java.lang.Class[] paramTypes, java.lang.Class javaClass, java.lang.String[] fields, int[] sqlTypes)
          Needed to process OQL queries of "CALL" type (using stored procedure call).
 java.lang.String getFactoryName()
          Returns the name of this factory.
 QueryExpression getQueryExpression()
          Returns a new empty query expression suitable for the underlying SQL engine.
 java.lang.Boolean isDuplicateKeyException(java.lang.Exception except)
          Determine if the given SQLException is DuplicateKeyException.
 
Methods inherited from class org.castor.cpa.persistence.sql.driver.GenericFactory
doubleQuoteName, quoteName
 
Methods inherited from class org.castor.cpa.persistence.sql.driver.BaseFactory
getPersistence, supportsSetNullInWhere
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY_NAME

public static final java.lang.String FACTORY_NAME
See Also:
Constant Field Values
Constructor Detail

InstantDBFactory

public InstantDBFactory()
Method Detail

getFactoryName

public java.lang.String getFactoryName()
Description copied from interface: PersistenceFactory
Returns the name of this factory. A descriptive name that indicates the type of supported database server or SQL syntax.

Specified by:
getFactoryName in interface PersistenceFactory
Overrides:
getFactoryName in class GenericFactory
Returns:
The name of this factory

getQueryExpression

public QueryExpression getQueryExpression()
Description copied from interface: PersistenceFactory
Returns a new empty query expression suitable for the underlying SQL engine. The implementation will construct SQL query statements in the preferred syntax.

Specified by:
getQueryExpression in interface PersistenceFactory
Overrides:
getQueryExpression in class GenericFactory
Returns:
New empty query expression

isDuplicateKeyException

public java.lang.Boolean isDuplicateKeyException(java.lang.Exception except)
Description copied from class: GenericFactory
Determine if the given SQLException is DuplicateKeyException.

Specified by:
isDuplicateKeyException in interface PersistenceFactory
Overrides:
isDuplicateKeyException in class GenericFactory
Returns:
Boolean.TRUE means "yes", Boolean.FALSE means "no", null means "cannot determine"

getCallQuery

public PersistenceQuery getCallQuery(java.lang.String call,
                                     java.lang.Class[] paramTypes,
                                     java.lang.Class javaClass,
                                     java.lang.String[] fields,
                                     int[] sqlTypes)
Needed to process OQL queries of "CALL" type (using stored procedure call). This feature is specific for JDO.

Specified by:
getCallQuery in interface PersistenceFactory
Overrides:
getCallQuery in class BaseFactory
Parameters:
call - Stored procedure call (without "{call")
paramTypes - The types of the query parameters
javaClass - The Java class of the query results
fields - The field names
sqlTypes - The field SQL types
Returns:
null if this feature is not supported.

adjustSqlType

public java.lang.Class adjustSqlType(java.lang.Class sqlType)
For NUMERIC type ResultSet.getObject() returns Double instead of BigDecimal for InstantDB.

Specified by:
adjustSqlType in interface PersistenceFactory
Overrides:
adjustSqlType in class BaseFactory
Parameters:
sqlType - The correspondent Java class for the SQL type in mapping.xml
Returns:
The correspondent Java class for the SQL type that should be used instead.


Copyright © 2011. All Rights Reserved.