TableSequenceDefinitionpublic class TableSequenceDefinition extends SequenceDefinition
Purpose: Allow a generic way of creating sequences on the different platforms,
and allow optional parameters to be specified.
|
Fields Summary |
---|
public String | sequenceTableNameHold the name of the sequence table | public String | sequenceNameFieldNameHold the name of the column in the sequence table which specifies the sequence name | public String | sequenceCounterFieldNameHold the name of the column in the sequence table which specifies the sequence numeric value | public int | initialValue |
Constructors Summary |
---|
public TableSequenceDefinition(String name, String sequenceTableName, String sequenceNameFieldName, String sequenceCounterFieldName, int initialValue)
super(name);
setSequenceTableName(sequenceTableName);
setSequenceCounterFieldName(sequenceCounterFieldName);
setSequenceNameFieldName(sequenceNameFieldName);
setInitialValue(initialValue);
| public TableSequenceDefinition(TableSequence sequence)
this(sequence.getName(), sequence.getTableName(), sequence.getNameFieldName(), sequence.getCounterFieldName(), sequence.getInitialValue());
| public TableSequenceDefinition(String name, TableSequence sequence)
this(name, sequence.getTableName(), sequence.getNameFieldName(), sequence.getCounterFieldName(), sequence.getInitialValue());
|
Methods Summary |
---|
public java.io.Writer | buildCreationWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)INTERNAL:
Return the SQL required to insert the sequence row into the sequence table.
Assume that the sequence table exists.
try {
writer.write("INSERT INTO ");
writer.write(getSequenceTableName());
writer.write("(" + getSequenceNameFieldName());
writer.write(", " + getSequenceCounterFieldName());
writer.write(") values (");
writer.write("'" + getName() + "', " + initialValue + ")");
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
return writer;
| public java.io.Writer | buildDeletionWriter(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)INTERNAL:
Return the SQL to delete the row from the sequence table.
try {
writer.write("DELETE FROM ");
writer.write(getSequenceTableName());
writer.write(" WHERE " + getSequenceNameFieldName());
writer.write(" = '" + getName() + "'");
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
return writer;
| public oracle.toplink.essentials.tools.schemaframework.TableDefinition | buildTableDefinition()INTERNAL:
Return a TableDefinition specifying sequence table.
TableDefinition definition = new TableDefinition();
definition.setName(getSequenceTableName());
definition.addPrimaryKeyField(getSequenceNameFieldName(), String.class, 50);
definition.addField(getSequenceCounterFieldName(), BigDecimal.class);
return definition;
| public boolean | checkIfExist(oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERAL:
Execute the SQL required to insert the sequence row into the sequence table.
Assume that the sequence table exists.
Vector results = session.executeSelectingCall(new oracle.toplink.essentials.queryframework.SQLCall("SELECT * FROM " + getSequenceTableName() + " WHERE " + getSequenceNameFieldName() + " = '" + getName() + "'"));
return !results.isEmpty();
| public java.lang.String | getSequenceCounterFieldName()PUBLIC:
return sequenceCounterFieldName;
| public java.lang.String | getSequenceNameFieldName()PUBLIC:
return sequenceNameFieldName;
| public java.lang.String | getSequenceTableName()PUBLIC:
return sequenceTableName;
| public void | setInitialValue(int initialValue)PUBLIC:
this.initialValue = initialValue;
| public void | setSequenceCounterFieldName(java.lang.String sequenceCounterFieldName)PUBLIC:
this.sequenceCounterFieldName = sequenceCounterFieldName;
| public void | setSequenceNameFieldName(java.lang.String sequenceNameFieldName)PUBLIC:
this.sequenceNameFieldName = sequenceNameFieldName;
| public void | setSequenceTableName(java.lang.String sequenceTableName)PUBLIC:
this.sequenceTableName = sequenceTableName;
|
|