/** * Add sequence corresponding to the name */ public void addSequence(Sequence sequence) { getDatasourcePlatform().addSequence(sequence); }
/** * Add the parameter. * If using binding bind the parameter otherwise let the platform print it. * The platform may also decide to bind the value. */ public void appendParameter(Writer writer, Object parameter, AbstractSession session) { session.getDatasourcePlatform().appendParameter(this, writer, parameter); }
/** * Extract primary key values from the specified row. * null is returned if the row does not contain the key. */ public Vector extractPrimaryKeyFromRow(AbstractRecord databaseRow, AbstractSession session) { List primaryKeyFields = getDescriptor().getPrimaryKeyFields(); Vector primaryKeyValues = new Vector(primaryKeyFields.size()); // PERF: use index not enumeration for (int index = 0; index < primaryKeyFields.size(); index++) { DatabaseField field = (DatabaseField)primaryKeyFields.get(index); // Ensure that the type extracted from the row is the same type as in the object. Class classification = (Class)getPrimaryKeyClassifications().get(index); Object value = databaseRow.get(field); if (value != null) { primaryKeyValues.addElement(session.getPlatform(getDescriptor().getJavaClass()).convertObject(value, classification)); } else { return null; } } return primaryKeyValues; }
/** * PUBLIC: * The default value to substitute for database NULLs can be configured * on a per-class basis. * Example: login.setDefaultNullValue(long.class, new Long(0)) */ public void setDefaultNullValue(Class type, Object value) { getDatasourcePlatform().getConversionManager().setDefaultNullValue(type, value); }
seqName = getSession().getDatasourcePlatform().getDefaultSequence().getName(); Sequence sequence = getSession().getDatasourcePlatform().getSequence(seqName);
DatabaseField modifyField = modifyRow.getField(field); if (modifyField != null) { if (session.getDatasourcePlatform().shouldUseCustomModifyForCall(modifyField)) { value = session.getDatasourcePlatform().getCustomModifyValueForCall(this, value, modifyField, shouldBind);
/** * Get default sequence */ public Sequence getDefaultSequence() { return getDatasourcePlatform().getDefaultSequence(); }
/** * Get sequence corresponding to the name */ public Sequence getSequence(String seqName) { return getDatasourcePlatform().getSequence(seqName); }
/** * INTERNAL: * Used only for writing the login into XML or Java. */ public Sequence getDefaultSequenceToWrite() { return getDatasourcePlatform().getDefaultSequenceToWrite(); }
/** * ADVANCED: * Set the database platform to be custom platform. */ public void usePlatform(Platform platform) { if (getDatasourcePlatform() != null) { getDatasourcePlatform().copyInto(platform); } setPlatform(platform); }
/** * INTERNAL: * Clone the login. * This also clones the platform as it is internal to the login. */ public Object clone() { DatasourceLogin clone = null; try { clone = (DatasourceLogin)super.clone(); } catch (Exception exception) { // should not happen...do nothing } if (getConnector() != null) { clone.setConnector((Connector)getConnector().clone()); } clone.setDatasourcePlatform((Platform)getDatasourcePlatform().clone()); clone.setProperties((Properties)properties.clone()); return clone; }
Object value = modifyRow.get(field); if (value != null) { value = session.getDatasourcePlatform().getCustomModifyValueForCall(this, value, field, false);
public Class resolveClass(ObjectStreamClass classDesc) throws ClassNotFoundException, IOException { ConversionManager cm = m_session.getDatasourceLogin().getDatasourcePlatform().getConversionManager(); return (Class)cm.convertObject(classDesc.getName(), Class.class); } }
public Sequence getDefaultSequence() { return getDatasourcePlatform().getDefaultSequence(); }
protected Sequence getSequence(String seqName) { return getOwnerSession().getDatasourcePlatform().getSequence(seqName); } }
/** * ADVANCE: * This method returns the class type that this changeSet Represents. * This requires the session to reload the class on serialization. * @return java.lang.Class */ public Class getClassType(oracle.toplink.essentials.sessions.Session session) { if (classType == null) { classType = (Class)((AbstractSession)session).getDatasourcePlatform().getConversionManager().convertObject(getClassName(), ClassConstants.CLASS); } return classType; }
/** * Extract the key field values from the specified row. * Used for batch reading. Keep the fields in the same order * as in the targetForeignKeysToSourceKeys hashtable. */ protected Vector extractKeyFromRow(AbstractRecord row, AbstractSession session) { Vector key = new Vector(this.getTargetForeignKeysToSourceKeys().size()); for (Iterator stream = this.getTargetForeignKeysToSourceKeys().values().iterator(); stream.hasNext();) { DatabaseField field = (DatabaseField)stream.next(); Object value = row.get(field); // Must ensure the classification to get a cache hit. try { value = session.getDatasourcePlatform().convertObject(value, getDescriptor().getObjectBuilder().getFieldClassification(field)); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(this, getDescriptor(), e); } key.addElement(value); } return key; }
protected Sequence getDefaultSequence() { return getOwnerSession().getDatasourcePlatform().getDefaultSequence(); }
if (sequence == null) { sequence = new DefaultSequence(seqName); getOwnerSession().getDatasourcePlatform().addSequence(sequence);
/** * Build the row from the primary key values. */ public AbstractRecord buildRowFromPrimaryKeyValues(Vector key, AbstractSession session) { AbstractRecord databaseRow = createRecord(key.size()); int keySize = key.size(); for (int index = 0; index < keySize; index++) { DatabaseField field = (DatabaseField)getDescriptor().getPrimaryKeyFields().get(index); Object value = key.elementAt(index); value = session.getPlatform(getDescriptor().getJavaClass()).getConversionManager().convertObject(value, field.getType()); databaseRow.put(field, value); } return databaseRow; }