com.samskivert.jdbc.depot
Class TableValueGenerator

java.lang.Object
  extended by com.samskivert.jdbc.depot.ValueGenerator
      extended by com.samskivert.jdbc.depot.TableValueGenerator

public class TableValueGenerator
extends ValueGenerator

Generates primary keys using an external table .


Field Summary
protected  boolean _initialized
           
protected  String _pkColumnName
           
protected  String _pkColumnValue
           
protected  String _valueColumnName
           
protected  String _valueTable
           
 
Fields inherited from class com.samskivert.jdbc.depot.ValueGenerator
_allocationSize, _dm, _fm, _initialValue, _migrateIfExists
 
Constructor Summary
TableValueGenerator(TableGenerator tg, GeneratedValue gv, DepotMarshaller<?> dm, FieldMarshaller<?> fm)
           
 
Method Summary
protected static String defStr(String value, String def)
          Convenience function to return a value or a default fallback.
 void delete(Connection conn, DatabaseLiaison liaison)
          Delete all database entities associated with this value generator.
 void init(Connection conn, DatabaseLiaison liaison)
          Ensures the generator is prepared for operation, creating it (only) if necessary.
 boolean isPostFactum()
          If true, this key generator will be run after the insert statement, if false, it will be run before.
 int nextGeneratedValue(Connection conn, DatabaseLiaison liaison)
          Fetch/generate the next primary key value.
 
Methods inherited from class com.samskivert.jdbc.depot.ValueGenerator
getDepotMarshaller, getFieldMarshaller, getFieldMaximum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_initialized

protected boolean _initialized

_valueTable

protected String _valueTable

_pkColumnName

protected String _pkColumnName

_pkColumnValue

protected String _pkColumnValue

_valueColumnName

protected String _valueColumnName
Constructor Detail

TableValueGenerator

public TableValueGenerator(TableGenerator tg,
                           GeneratedValue gv,
                           DepotMarshaller<?> dm,
                           FieldMarshaller<?> fm)
Method Detail

isPostFactum

public boolean isPostFactum()
Description copied from class: ValueGenerator
If true, this key generator will be run after the insert statement, if false, it will be run before.

Specified by:
isPostFactum in class ValueGenerator

init

public void init(Connection conn,
                 DatabaseLiaison liaison)
          throws SQLException
Description copied from class: ValueGenerator
Ensures the generator is prepared for operation, creating it (only) if necessary.

Specified by:
init in class ValueGenerator
Throws:
SQLException

delete

public void delete(Connection conn,
                   DatabaseLiaison liaison)
            throws SQLException
Description copied from class: ValueGenerator
Delete all database entities associated with this value generator.

Specified by:
delete in class ValueGenerator
Throws:
SQLException

nextGeneratedValue

public int nextGeneratedValue(Connection conn,
                              DatabaseLiaison liaison)
                       throws SQLException
Description copied from class: ValueGenerator
Fetch/generate the next primary key value.

Specified by:
nextGeneratedValue in class ValueGenerator
Throws:
SQLException

defStr

protected static String defStr(String value,
                               String def)
Convenience function to return a value or a default fallback.



Copyright © 2000-2008 Michael Bayne. All Rights Reserved.