org.apache.torque.oid
Class SequenceIdGenerator

java.lang.Object
  extended by org.apache.torque.oid.AbstractIdGenerator
      extended by org.apache.torque.oid.SequenceIdGenerator
All Implemented Interfaces:
IdGenerator

public class SequenceIdGenerator
extends AbstractIdGenerator

This generator works with databases that have an sql syntax for getting an id prior to inserting a row into the database.

Version:
$Id: SequenceIdGenerator.java 1377476 2012-08-26 18:42:31Z tv $
Author:
John D. McNally

Field Summary
 
Fields inherited from class org.apache.torque.oid.AbstractIdGenerator
adapter, databaseName
 
Constructor Summary
SequenceIdGenerator(Adapter adapter, String databaseName)
          Creates an IdGenerator which will work with the specified database.
 
Method Summary
 boolean isConnectionRequired()
          A flag to determine whether a Connection is required to generate an id.
 boolean isPostInsert()
          A flag to determine the timing of the id generation
 boolean isPriorToInsert()
          A flag to determine the timing of the id generation
 
Methods inherited from class org.apache.torque.oid.AbstractIdGenerator
getId, getIdAsBigDecimal, getIdAsInt, getIdAsLong, getIdAsString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceIdGenerator

public SequenceIdGenerator(Adapter adapter,
                           String databaseName)
Creates an IdGenerator which will work with the specified database.

Parameters:
adapter - the adapter that knows the correct sql syntax.
databaseName - The name of the database to find the correct schema.
Method Detail

isPriorToInsert

public boolean isPriorToInsert()
A flag to determine the timing of the id generation

Specified by:
isPriorToInsert in interface IdGenerator
Specified by:
isPriorToInsert in class AbstractIdGenerator
Returns:
a boolean value

isPostInsert

public boolean isPostInsert()
A flag to determine the timing of the id generation

Specified by:
isPostInsert in interface IdGenerator
Specified by:
isPostInsert in class AbstractIdGenerator
Returns:
a boolean value

isConnectionRequired

public boolean isConnectionRequired()
A flag to determine whether a Connection is required to generate an id.

Specified by:
isConnectionRequired in interface IdGenerator
Specified by:
isConnectionRequired in class AbstractIdGenerator
Returns:
a boolean value


Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.