Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jdbf.engine.keygen
Class KeyKeeper  view KeyKeeper download KeyKeeper.java

java.lang.Object
  extended byorg.jdbf.engine.keygen.KeyKeeper

public class KeyKeeper
extends java.lang.Object

This class provides generated keys. The method is similar to the one called Key-Values by Scott Ambler in Mapping Objects to Relational Databases. With this method, there's a multi-row table which has three columns, one for the identifier for the table name, one for the identifier for the key table and another for the next key value for that table.

Version:
$id$

Field Summary
private  int columnType
          Represents the tyoe of column of high value
private static int DATA_TYPE
          Represents the sql type for high value
private  org.jdbf.engine.mapping.HighLowMap hiloMap
          The high value is combined with the low value to produce the key.
private  boolean isUsed
          Indicates if KeyKeeper is used
private static int PROGRESSIVE
          Represents the progressive to add the high forn new insert operation
private  java.lang.String tableName
          The key is generated for this table.
 
Constructor Summary
KeyKeeper(java.lang.String tableName, org.jdbf.engine.mapping.HighLowMap hiloMap)
          Creates the object given talbe name,given hiloMap
 
Method Summary
private  org.jdbf.engine.mapping.HighLowMap fetchHigh(java.sql.Connection conn, java.lang.String vendor)
          Obtains a block of available keys from the key-values table.
private  int getColumnType(java.sql.Connection conn, java.lang.String table, java.lang.String column)
          Return column's type fo column specified in column parameter.
 java.lang.Object nextKey(java.sql.Connection conn, java.lang.String vendor)
          Returns the next generated key.
private  int updateLow(java.sql.Connection conn, org.jdbf.engine.mapping.HighLowMap hiloMap)
          Updates in table where keyGenerators are mapped the new low value specified in table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_TYPE

private static int DATA_TYPE
Represents the sql type for high value


PROGRESSIVE

private static int PROGRESSIVE
Represents the progressive to add the high forn new insert operation


columnType

private int columnType
Represents the tyoe of column of high value


tableName

private java.lang.String tableName
The key is generated for this table.


isUsed

private boolean isUsed
Indicates if KeyKeeper is used


hiloMap

private org.jdbf.engine.mapping.HighLowMap hiloMap
The high value is combined with the low value to produce the key.

Constructor Detail

KeyKeeper

public KeyKeeper(java.lang.String tableName,
                 org.jdbf.engine.mapping.HighLowMap hiloMap)
Creates the object given talbe name,given hiloMap

Method Detail

fetchHigh

private org.jdbf.engine.mapping.HighLowMap fetchHigh(java.sql.Connection conn,
                                                     java.lang.String vendor)
                                              throws org.jdbf.engine.mapping.MappingException
Obtains a block of available keys from the key-values table.


getColumnType

private final int getColumnType(java.sql.Connection conn,
                                java.lang.String table,
                                java.lang.String column)
                         throws java.sql.SQLException,
                                org.jdbf.engine.mapping.MappingException
Return column's type fo column specified in column parameter.


nextKey

public java.lang.Object nextKey(java.sql.Connection conn,
                                java.lang.String vendor)
                         throws org.jdbf.engine.mapping.MappingException
Returns the next generated key.


updateLow

private int updateLow(java.sql.Connection conn,
                      org.jdbf.engine.mapping.HighLowMap hiloMap)
               throws org.jdbf.engine.mapping.MappingException
Updates in table where keyGenerators are mapped the new low value specified in table.