|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjodd.db.orm.DbOrmManager
public class DbOrmManager
Global DB-ORM mapping definitions, prefixes and cache.
Mapping definitions are used only by a result set mapper (such as ResultSetMapper
to lookup for an entity from table name. Table names are read from result-set meta data, for example.
Moreover, it is not needed to use mappings at all: in that case just provide entity types during result set to
objects conversion.
| Field Summary | |
|---|---|
protected java.lang.String |
columnAliasSeparator
|
protected boolean |
columnNameUppercase
|
protected ColumnAliasType |
defaultColumnAliasType
|
protected java.util.Map<java.lang.Class,DbEntityDescriptor> |
descriptors
|
protected java.util.Map<java.lang.String,DbEntityDescriptor> |
entityNames
|
protected JoinHintResolver |
hintResolver
|
protected java.lang.String[] |
primitiveEntitiesPrefixes
|
protected java.lang.String |
schemaName
|
protected java.lang.String |
tableNamePrefix
|
protected java.util.Map<java.lang.String,DbEntityDescriptor> |
tableNames
|
protected java.lang.String |
tableNameSuffix
|
protected boolean |
tableNameUppercase
|
| Constructor Summary | |
|---|---|
protected |
DbOrmManager()
|
| Method Summary | ||
|---|---|---|
protected DbEntityDescriptor |
createDbEntityDescriptor(java.lang.Class type)
Creates DbEntityDescriptor. |
|
|
createEntityInstance(java.lang.Class<E> type)
Creates new entity instances. |
|
ResultSetMapper |
createResultSetMapper(java.sql.ResultSet resultSet,
java.util.Map<java.lang.String,ColumnData> columnAliases)
Creates a new instance of ResultSetMapper. |
|
java.lang.String |
getColumnAliasSeparator()
Returns value for separator for column aliases that divides table reference and column name. |
|
ColumnAliasType |
getDefaultColumnAliasType()
|
|
JoinHintResolver |
getHintResolver()
|
|
static DbOrmManager |
getInstance()
Returns current DB-ORM manager instance. |
|
java.lang.String[] |
getPrimitiveEntitiesPrefixes()
|
|
java.lang.String |
getSchemaName()
Returns default schema name. |
|
java.lang.String |
getTableNamePrefix()
Returns current table prefix. |
|
java.lang.String |
getTableNameSuffix()
Returns table name suffix. |
|
int |
getTotalNames()
Returns total number of registered entity names. |
|
int |
getTotalTableNames()
Returns total number of registered table names. |
|
int |
getTotalTypes()
Returns total number of registered types. |
|
boolean |
isColumnNameUppercase()
Returns true if column names are uppercase. |
|
boolean |
isRegistered(java.lang.Class type)
Returns true if type is registered withing manager. |
|
boolean |
isTableNameUppercase()
Returns true if table names are uppercase. |
|
DbEntityDescriptor |
lookupName(java.lang.String typeName)
Lookups for DbEntityDescriptor that was registered with this manager. |
|
DbEntityDescriptor |
lookupTableName(java.lang.String typeName)
Lookups for DbEntityDescriptor that was registered with this manager. |
|
DbEntityDescriptor |
lookupType(java.lang.Class type)
Lookups DbEntityDescriptor for some type and registers the type if is new. |
|
DbEntityDescriptor |
registerEntity(java.lang.Class type)
Registers entity. |
|
DbEntityDescriptor |
registerEntity(java.lang.Class type,
boolean force)
Registers entity. |
|
DbEntityDescriptor |
registerType(java.lang.Class type)
Registers just type and entity names. |
|
DbEntityDescriptor |
removeEntity(java.lang.Class type)
Removes entity. |
|
void |
reset()
Resets the manager and clears descriptors cache. |
|
void |
setColumnAliasSeparator(java.lang.String separator)
Specifies separator for column aliases that divides table reference and column name. |
|
void |
setColumnNameUppercase(boolean columnNameUppercase)
Specifies if column names are in upper case. |
|
void |
setDefaultColumnAliasType(ColumnAliasType defaultColumnAliasType)
|
|
void |
setHintResolver(JoinHintResolver hintResolver)
|
|
static void |
setInstance(DbOrmManager ormManager)
Sets new instance for DB-ORM manager. |
|
void |
setPrimitiveEntitiesPrefixes(java.lang.String... primitiveEntitiesPrefixes)
Specifies array of class name prefixes that will be mapped directly to column. |
|
void |
setSchemaName(java.lang.String schemaName)
Specifies default schema name. |
|
void |
setTableNamePrefix(java.lang.String prefix)
Specifies default table prefix for all tables. |
|
void |
setTableNameSuffix(java.lang.String suffix)
Specifies default table name suffix. |
|
void |
setTableNameUppercase(boolean tableNameUppercase)
Specifies if table names are in upper case. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean tableNameUppercase
protected boolean columnNameUppercase
protected java.lang.String tableNamePrefix
protected java.lang.String tableNameSuffix
protected java.lang.String schemaName
protected java.lang.String[] primitiveEntitiesPrefixes
protected java.util.Map<java.lang.Class,DbEntityDescriptor> descriptors
protected java.util.Map<java.lang.String,DbEntityDescriptor> entityNames
protected java.util.Map<java.lang.String,DbEntityDescriptor> tableNames
protected java.lang.String columnAliasSeparator
protected JoinHintResolver hintResolver
protected ColumnAliasType defaultColumnAliasType
| Constructor Detail |
|---|
protected DbOrmManager()
| Method Detail |
|---|
public static DbOrmManager getInstance()
public static void setInstance(DbOrmManager ormManager)
public void setTableNameUppercase(boolean tableNameUppercase)
public boolean isTableNameUppercase()
true if table names are uppercase.
public void setColumnNameUppercase(boolean columnNameUppercase)
public boolean isColumnNameUppercase()
true if column names are uppercase.
public void setTableNamePrefix(java.lang.String prefix)
public java.lang.String getTableNamePrefix()
public java.lang.String getTableNameSuffix()
public void setTableNameSuffix(java.lang.String suffix)
public java.lang.String getSchemaName()
public void setSchemaName(java.lang.String schemaName)
public java.lang.String[] getPrimitiveEntitiesPrefixes()
public void setPrimitiveEntitiesPrefixes(java.lang.String... primitiveEntitiesPrefixes)
public DbEntityDescriptor lookupType(java.lang.Class type)
DbEntityDescriptor for some type and registers the type if is new.
Returns null for core classes from java run-time packages!
Some types are not entities, i.e. domain objects. Instead, primitive entities
are simply mapped to one column.
public boolean isRegistered(java.lang.Class type)
true if type is registered withing manager.
public DbEntityDescriptor lookupName(java.lang.String typeName)
DbEntityDescriptor that was registered with this manager.
Returns null if name not found.
public DbEntityDescriptor lookupTableName(java.lang.String typeName)
DbEntityDescriptor that was registered with this manager.
Returns null if table name not found.
public DbEntityDescriptor registerType(java.lang.Class type)
public DbEntityDescriptor registerEntity(java.lang.Class type)
Registers types and table names.
Throw exception is type is already registered.
public DbEntityDescriptor registerEntity(java.lang.Class type,
boolean force)
public DbEntityDescriptor removeEntity(java.lang.Class type)
protected DbEntityDescriptor createDbEntityDescriptor(java.lang.Class type)
DbEntityDescriptor.
public int getTotalNames()
public int getTotalTableNames()
public int getTotalTypes()
public void reset()
public java.lang.String getColumnAliasSeparator()
public void setColumnAliasSeparator(java.lang.String separator)
public JoinHintResolver getHintResolver()
public void setHintResolver(JoinHintResolver hintResolver)
public ColumnAliasType getDefaultColumnAliasType()
public void setDefaultColumnAliasType(ColumnAliasType defaultColumnAliasType)
public ResultSetMapper createResultSetMapper(java.sql.ResultSet resultSet,
java.util.Map<java.lang.String,ColumnData> columnAliases)
ResultSetMapper.
public <E> E createEntityInstance(java.lang.Class<E> type)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||