org.jdbcpersistence
Class JDBCMap

java.lang.Object
  extended by org.jdbcpersistence.JDBCMap

public final class JDBCMap
extends java.lang.Object

The JDBCMap class associates ('maps') a bean with a table and JDBCPersistor.

 Example:
 
    JDBCMap jdbcMap = jdbcPersistence.registerPersistent(FooBean.class, "FOO_TABLE", null);
    jdbcMap.map("id", "ID");
    jdbcMap.map("name", "NAME");
    jdbcMap.map("description", "DESCRIPTION");
 
 

Author:
Alex Rojkov Date: 8-Aug-2005 Time: 1:45:15 PM
See Also:
JDBCPersistence.registerPersistent(Class,String,Class), JDBCMap.Column

Nested Class Summary
 class JDBCMap.Column
          Class JDBCMap.Column is used to configure and hold mapping information for a database column.
 
Method Summary
 JDBCMap.Column getColumn(java.lang.String columnName)
          Returns JDBCMap.Column object mapped to the supplied in the argument columnName
 JDBCMap.Column[] getColumns()
          Retuns an unordered array of all columns mapped into this instance of JDBCMap
 JDBCMap.Column[] getIdentifyingColumns()
          Returns an unordered array of identifying columns mapped into this instance of JDBCMap
 java.lang.Class getJdbcPersistorClass()
          Returns Class responsible for persistence of an associated bean
 java.lang.Class getMappedClass()
          Returns Class of the associated bean, abstract class or an interface
 JDBCMap.Column[] getRegularColumns()
          Returns an unordered array of unidentifying columns mapped into this instance of JDBCMap
 java.lang.String getSchema()
          Returns the name of the underlying schema
 java.lang.String getTableName()
          Returns name of the associated table
 JDBCMap.Column getVersionControlColumn()
          Returns JDBCMap.Column that performs function of tracking version information
 JDBCMap.Column map(java.lang.String beanProperty, java.lang.String column)
          The method maps a column in the database to a property of a bean.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSchema

public java.lang.String getSchema()
Returns the name of the underlying schema

Returns:
name of the underlying schema

getColumn

public JDBCMap.Column getColumn(java.lang.String columnName)
Returns JDBCMap.Column object mapped to the supplied in the argument columnName

Parameters:
columnName -
Returns:
Column

map

public JDBCMap.Column map(java.lang.String beanProperty,
                          java.lang.String column)
The method maps a column in the database to a property of a bean. The algorithm finds getter and setter for a particular property using the java bean naming convention of set, get and is to handle all properties with the exception of properties that map to Clob and Blob typed fields. The convention for Lobs is to use write method for a getter and read method for a setter a.k.a. when the bean sets the property it reads value from Lob's Reader vs. when the bean handles outputting the value to the Writer it writes it to a Lob's Writer.

Parameters:
beanProperty - is a java.lang.String representing the name of a property of a bean, the value is case sensetive.
column - is a java.lang.String representing the name of the column in the database. The value is case sensetive.
Returns:
org.jdbcpersistence.JDBCMap.Column that holds information on the mapped column and property of a bean.

getRegularColumns

public JDBCMap.Column[] getRegularColumns()
Returns an unordered array of unidentifying columns mapped into this instance of JDBCMap

Returns:
an array of JDBCMap.Column

getColumns

public JDBCMap.Column[] getColumns()
Retuns an unordered array of all columns mapped into this instance of JDBCMap

Returns:
an array of JDBCMap.Column

getIdentifyingColumns

public JDBCMap.Column[] getIdentifyingColumns()
Returns an unordered array of identifying columns mapped into this instance of JDBCMap

Returns:
an array of JDBCMap.Column

getVersionControlColumn

public JDBCMap.Column getVersionControlColumn()
Returns JDBCMap.Column that performs function of tracking version information

Returns:
a JDBCMap.Column

getMappedClass

public final java.lang.Class getMappedClass()
Returns Class of the associated bean, abstract class or an interface

Returns:
mapped class

getJdbcPersistorClass

public java.lang.Class getJdbcPersistorClass()
Returns Class responsible for persistence of an associated bean

Returns:
a class implementing JDBCPersistor if one was supplied or null

getTableName

public java.lang.String getTableName()
Returns name of the associated table

Returns:
name of table