public int getInitialValue() { return getDefaultSequence().getInitialValue(); }
public int getInitialValue() { return getDefaultSequence().getInitialValue(); }
public int getInitialValue() { return getDefaultSequence().getInitialValue(); }
/** * INTERNAL: * Return the SQL required to create the unary sequence table. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getName()); writer.write("(" + getSequenceCounterFieldName()); writer.write(") values ("+Integer.toString(sequence.getInitialValue() - 1)+")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to create the unary sequence table. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getName()); writer.write("(" + getSequenceCounterFieldName()); writer.write(") values ("+Integer.toString(sequence.getInitialValue() - 1)+")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
public int getInitialValue() { if ((initialValue != 0) || (getDefaultSequence() == null)) { return initialValue; } else { return getDefaultSequence().getInitialValue(); } }
public int getInitialValue() { if ((initialValue != 0) || (getDefaultSequence() == null)) { return initialValue; } else { return getDefaultSequence().getInitialValue(); } }
/** * INTERNAL: * Return the SQL required to create the unary sequence table. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getName()); writer.write("(" + getSequenceCounterFieldName()); writer.write(") values ("+Integer.toString(sequence.getInitialValue() - 1)+")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
public int getInitialValue() { if ((initialValue != 0) || (getDefaultSequence() == null)) { return initialValue; } else { return getDefaultSequence().getInitialValue(); } }
/** * INTERNAL: * Return the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getSequenceTableQualifiedName()); writer.write("(" + getSequenceNameFieldName()); writer.write(", " + getSequenceCounterFieldName()); writer.write(") values ("); writer.write("'" + getName() + "', " + Integer.toString(sequence.getInitialValue() - 1) + ")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getSequenceTableQualifiedName()); writer.write("(" + getSequenceNameFieldName()); writer.write(", " + getSequenceCounterFieldName()); writer.write(") values ("); writer.write("'" + getName() + "', " + Integer.toString(sequence.getInitialValue() - 1) + ")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to insert the sequence row into the sequence table. * Assume that the sequence table exists. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException { try { writer.write("INSERT INTO "); writer.write(getSequenceTableName()); writer.write("(" + getSequenceNameFieldName()); writer.write(", " + getSequenceCounterFieldName()); writer.write(") values ("); writer.write("'" + getName() + "', " + Integer.toString(sequence.getInitialValue() - 1) + ")"); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
protected void logDebugSequencingConnected(int nAlreadyConnectedSequences) { Vector[] sequenceVectors = new Vector[NUMBER_OF_STATES]; int size = connectedSequences.size(); for (int i = nAlreadyConnectedSequences; i < size; i++) { Sequence sequence = (Sequence)connectedSequences.get(i); int stateId = getStateId(sequence.shouldUsePreallocation(), sequence.shouldUseTransaction()); Vector v = sequenceVectors[stateId]; if (v == null) { v = new Vector(); sequenceVectors[stateId] = v; } v.addElement(sequence); } for (int i = 0; i < NUMBER_OF_STATES; i++) { Vector v = sequenceVectors[i]; if (v != null) { getOwnerSession().log(SessionLog.FINEST, SessionLog.SEQUENCING, "sequencing_connected", states[i]); for (int j = 0; j < v.size(); j++) { Sequence sequence = (Sequence)v.elementAt(j); Object[] args = { sequence.getName(), Integer.toString(sequence.getPreallocationSize()), Integer.toString(sequence.getInitialValue())}; getOwnerSession().log(SessionLog.FINEST, SessionLog.SEQUENCING, "sequence_without_state", args); } } } }
protected void logDebugSequencingConnected() { Vector[] sequenceVectors = new Vector[NUMBER_OF_STATES]; Iterator itConnectedSequences = connectedSequences.iterator(); while (itConnectedSequences.hasNext()) { Sequence sequence = (Sequence)itConnectedSequences.next(); int stateId = getStateId(sequence.shouldUsePreallocation(), sequence.shouldUseTransaction()); Vector v = sequenceVectors[stateId]; if (v == null) { v = new Vector(); sequenceVectors[stateId] = v; } v.addElement(sequence); } for (int i = 0; i < NUMBER_OF_STATES; i++) { Vector v = sequenceVectors[i]; if (v != null) { getOwnerSession().log(SessionLog.FINEST, SessionLog.SEQUENCING, "sequencing_connected", states[i]); for (int j = 0; j < v.size(); j++) { Sequence sequence = (Sequence)v.elementAt(j); Object[] args = { sequence.getName(), Integer.toString(sequence.getPreallocationSize()), Integer.toString(sequence.getInitialValue())}; getOwnerSession().log(SessionLog.FINEST, SessionLog.SEQUENCING, "sequence_without_state", args); } } } }
/** * INTERNAL: * Return the SQL required to create the Oracle sequence object. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) { try { // startWith value calculated using the initial value and increment. // The first time TopLink calls select nextval, the value equal to startWith is returned. // The first sequence value EclipseLink may assign is startWith - getIncrement() + 1. int startWith = sequence.getInitialValue() + sequence.getPreallocationSize() - 1; session.getPlatform().buildSequenceObjectCreationWriter(writer, getFullName(), sequence.getPreallocationSize(), startWith); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to create the Oracle sequence object. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) { try { // startWith value calculated using the initial value and increment. // The first time TopLink calls select nextval, the value equal to startWith is returned. // The first sequence value EclipseLink may assign is startWith - getIncrement() + 1. int startWith = sequence.getInitialValue() + sequence.getPreallocationSize() - 1; session.getPlatform().buildSequenceObjectCreationWriter(writer, getFullName(), sequence.getPreallocationSize(), startWith); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * INTERNAL: * Return the SQL required to create the Oracle sequence object. */ public Writer buildCreationWriter(AbstractSession session, Writer writer) { try { // startWith value calculated using the initial value and increment. // The first time TopLink calls select nextval, the value equal to startWith is returned. // The first sequence value EclipseLink may assign is startWith - getIncrement() + 1. int startWith = sequence.getInitialValue() + sequence.getPreallocationSize() - 1; session.getPlatform().buildSequenceObjectCreationWriter(writer, getFullName(), sequence.getPreallocationSize(), startWith); } catch (IOException ioException) { throw ValidationException.fileError(ioException); } return writer; }
/** * PUBLIC: * EclipseLink can be configured to use a sequence table * or native sequencing to generate unique object IDs. * Native sequencing uses the ID generation service provided by the database * (e.g. SEQUENCE objects on Oracle and IDENTITY columns on Sybase). * By default a sequence table is used. Using a sequence table is recommended * as it supports preallocation. * (Native sequencing on Sybase/SQL Server/Informix does not support preallocation. * Preallocation can be supported on Oracle by setting the increment size of the * SEQUENCE object to match the preallocation size.) */ public void useNativeSequencing() { if(!shouldUseNativeSequencing()) { getPlatform().setDefaultSequence(new NativeSequence(getPlatform().getDefaultSequence().getName(), getPlatform().getDefaultSequence().getPreallocationSize(), getPlatform().getDefaultSequence().getInitialValue())); } }
/** * PUBLIC: * EclipseLink can be configured to use a sequence table * or native sequencing to generate unique object IDs. * Native sequencing uses the ID generation service provided by the database * (e.g. SEQUENCE objects on Oracle and IDENTITY columns on Sybase). * By default a sequence table is used. Using a sequence table is recommended * as it supports preallocation. * (Native sequencing on Sybase/SQL Server/Informix does not support preallocation. * Preallocation can be supported on Oracle by setting the increment size of the * SEQUENCE object to match the preallocation size.) */ public void useNativeSequencing() { if(!shouldUseNativeSequencing()) { getPlatform().setDefaultSequence(new NativeSequence(getPlatform().getDefaultSequence().getName(), getPlatform().getDefaultSequence().getPreallocationSize(), getPlatform().getDefaultSequence().getInitialValue())); } }
/** * PUBLIC: * EclipseLink can be configured to use a sequence table * or native sequencing to generate unique object IDs. * Native sequencing uses the ID generation service provided by the database * (e.g. SEQUENCE objects on Oracle and IDENTITY columns on Sybase). * By default a sequence table is used. Using a sequence table is recommended * as it supports preallocation. * (Native sequencing on Sybase/SQL Server/Informix does not support preallocation. * Preallocation can be supported on Oracle by setting the increment size of the * SEQUENCE object to match the preallocation size.) */ public void useNativeSequencing() { if(!shouldUseNativeSequencing()) { getPlatform().setDefaultSequence(new NativeSequence(getPlatform().getDefaultSequence().getName(), getPlatform().getDefaultSequence().getPreallocationSize(), getPlatform().getDefaultSequence().getInitialValue())); } }