fr.gouv.culture.sdx.utils.database
Class ORACLEDatabase
java.lang.Object
fr.gouv.culture.sdx.utils.AbstractSdxObject
fr.gouv.culture.sdx.utils.rdbms.JDBC
fr.gouv.culture.sdx.utils.rdbms.DataSourceComponentBacked
fr.gouv.culture.sdx.utils.database.AbstractJDBCDatabase
fr.gouv.culture.sdx.utils.database.JDBCDatabase
fr.gouv.culture.sdx.utils.database.ORACLEDatabase
- All Implemented Interfaces:
- Database, Describable, Encodable, Identifiable, Localizable, Saveable, SdxObject, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable
public class ORACLEDatabase
- extends JDBCDatabase
An Oracle implementation of the SDX Database interface.
Tested with Oracle 10g under Windows. Should work with many Oracle versions.
Fields inherited from class fr.gouv.culture.sdx.utils.rdbms.JDBC |
tableName |
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized |
Method Summary |
protected void |
createIndicies(java.sql.Connection conn)
Creates the index on the ID field. |
protected java.lang.String |
getCreateIndiciesQuery(java.lang.String fieldName)
For performance reasons, we create an index on the ID field. |
protected java.lang.String |
getTableCreationQuery()
Returns the CREATE TABLE statement. |
void |
init()
Initialise l'entrepot. |
void |
save(DatabaseEntity ent)
We slightly modify the default behaviour to insert a dummy property when
an entity has no property defined. |
Methods inherited from class fr.gouv.culture.sdx.utils.database.AbstractJDBCDatabase |
addProperty, backup, configure, delete, delete, empty, entityExists, getAllEntitiesQuery, getClassNameSuffix, getConnection, getDeleteAllQuery, getEntities, getEntities, getEntity, getEntity, getEntityDeleteQuery, getEntityGetQuery, getEntityIds, getProperties, getPropertyAddQuery, getPropertyRemoveQueryWithId, getPropertyRemoveQueryWithoutId, getPropertyValue, getPropertyValues, getWildcardSearchToken, releaseConnection, removeProperty, removeProperty, restore, search, search, searchWithParams, size, update |
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface fr.gouv.culture.sdx.utils.SdxObject |
getLog |
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled |
enableLogging |
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable |
contextualize |
Methods inherited from interface org.apache.avalon.framework.service.Serviceable |
service |
Methods inherited from interface org.apache.excalibur.xml.sax.XMLizable |
toSAX |
ORACLEDatabase
public ORACLEDatabase()
getTableCreationQuery
protected java.lang.String getTableCreationQuery()
- Returns the CREATE TABLE statement.
For Oracle, we do not use a sequence, we define a PRIMARY KEY on the three
fields (ID, NAME, VALUE). We force NOT NULL because the three fields are
part of the PRIMARY KEY, and thus Oracle forces them to be not null anyway.
- Overrides:
getTableCreationQuery
in class AbstractJDBCDatabase
- Returns:
- The query.
see subclasses for implementation
getCreateIndiciesQuery
protected java.lang.String getCreateIndiciesQuery(java.lang.String fieldName)
- For performance reasons, we create an index on the ID field.
- Overrides:
getCreateIndiciesQuery
in class AbstractJDBCDatabase
init
public void init()
throws SDXException
- Initialise l'entrepot. Si la table n'existe pas, elle est creee.
On surcharge cette methode car Oracle reagit bizarrement au
DatabaseMetaData. On fait simplement une requete.
- Specified by:
init
in interface Database
- Overrides:
init
in class AbstractJDBCDatabase
- Throws:
SDXException
createIndicies
protected void createIndicies(java.sql.Connection conn)
throws SDXException
- Creates the index on the ID field.
- Overrides:
createIndicies
in class AbstractJDBCDatabase
- Throws:
SDXException
save
public void save(DatabaseEntity ent)
throws SDXException
- We slightly modify the default behaviour to insert a dummy property when
an entity has no property defined. In the normal code, an empty string is
used, but the Oracle JDBC driver inserts null instead of empty spaces, thus
violating the primary key constraints (no null) on the three fields.
- Specified by:
save
in interface Database
- Overrides:
save
in class AbstractJDBCDatabase
- Throws:
SDXException
Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.