com.jenkov.mrpersister.impl.mapping
Class DbPrimaryKeyDeterminer
java.lang.Object
com.jenkov.mrpersister.impl.mapping.DbPrimaryKeyDeterminer
- All Implemented Interfaces:
- IDbPrimaryKeyDeterminer
public class DbPrimaryKeyDeterminer
- extends java.lang.Object
- implements IDbPrimaryKeyDeterminer
- Author:
- Jakob Jenkov, Jenkov Development
Method Summary |
java.lang.String |
getPrimaryKeyColumnName(java.lang.String table,
java.lang.String databaseName,
java.sql.Connection connection)
Deprecated. This method doesn't support compound keys (multi-column keys).
Use the getPrimaryKeyMapping method instead. |
IKey |
getPrimaryKeyMapping(java.lang.String table,
java.lang.String databaseName,
java.sql.Connection connection)
Returns a list of the columns that are part of the |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DbPrimaryKeyDeterminer
public DbPrimaryKeyDeterminer()
getPrimaryKeyColumnName
public java.lang.String getPrimaryKeyColumnName(java.lang.String table,
java.lang.String databaseName,
java.sql.Connection connection)
throws PersistenceException
- Deprecated. This method doesn't support compound keys (multi-column keys).
Use the getPrimaryKeyMapping method instead.
- Description copied from interface:
IDbPrimaryKeyDeterminer
- Returns the primary key column name for the given table and database. The database name is optional
as this name is usually implicitly referenced in the database connection. You can leave it to null
in most cases (in fact you should only need to set this if referencing a database other than the
one connected to. A different database on the same server that is, not a different database server).
- Specified by:
getPrimaryKeyColumnName
in interface IDbPrimaryKeyDeterminer
- Parameters:
table
- The name of the table to determine the primary key column name of.databaseName
- The name of the database. Set this to null in most cases. See above description.connection
- The connection to the database in which the table exists to determine primary
key column for.
- Returns:
- The name of the primary key column of the given table. Null if the table
has no primary key.
- Throws:
PersistenceException
- If anything goes wrong during primary key column name determining.
getPrimaryKeyMapping
public IKey getPrimaryKeyMapping(java.lang.String table,
java.lang.String databaseName,
java.sql.Connection connection)
throws PersistenceException
- Description copied from interface:
IDbPrimaryKeyDeterminer
- Returns a list of the columns that are part of the
- Specified by:
getPrimaryKeyMapping
in interface IDbPrimaryKeyDeterminer
- Returns:
-
- Throws:
PersistenceException