org.apache.torque.oid
Class AutoIncrementIdGenerator

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

public class AutoIncrementIdGenerator
extends AbstractIdGenerator

This generator works with databases that have an sql syntax that allows the retrieval of the last id used to insert a row for a Connection.

Version:
$Id: AutoIncrementIdGenerator.java 1388656 2012-09-21 19:59:16Z tfischer $
Author:
John D. McNally

Field Summary
 
Fields inherited from class org.apache.torque.oid.AbstractIdGenerator
adapter, databaseName
 
Constructor Summary
AutoIncrementIdGenerator(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

AutoIncrementIdGenerator

public AutoIncrementIdGenerator(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 databaseName 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 final 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.