net.toften.jlips.persist.db.pk
Class PrimaryKeyHandlerFactory
java.lang.Object
net.toften.jlips.persist.db.pk.PrimaryKeyHandlerFactory
public final class PrimaryKeyHandlerFactory
- extends Object
This factory is used to manage the primary keys for the records in the
database
Each record must have a primary key field. The primary key must be defined
in the database when the table is created.
The SQL for this could be:
CREATE TABLE person
(
id INTEGER ,
name VARCHAR(40) ,
birthday DATE ,
PRIMARY KEY(id)
);
Each table should only have one primary key field.
The factory will create a handler for the primary key of each table.
This is done when the TableHandler
is
created.
- Author:
- thomas
- See Also:
PrimaryKeyHandler
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getPrimaryKeyHandler
public static PrimaryKeyHandler getPrimaryKeyHandler(DBTableInfo tableInfo)
throws BadDatabaseFormatException,
SQLException
- Return a
PrimaryKeyHandler
for the specified table
Given a table, the factory will create a primary key handler
and return it. The created key handler will deal with whatever
type of primary key and this will be transparent to the TableHandler
- Parameters:
tableInfo
- The table info
- Returns:
- The created
PrimaryKeyHandler
- Throws:
BadDatabaseFormatException
- If the table has no defined key or the
data type of the primary key is not supported
SQLException