|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjodd.db.orm.DbOrm
public class DbOrm
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
|
static ColumnAliasType |
DEFAULT_COLUMN_ALIAS_TYPE
Default column alias type, when they are used. |
protected java.util.Map<java.lang.Class,DbEntityDescriptor> |
descriptors
|
protected java.util.Map<java.lang.String,DbEntityDescriptor> |
entityNames
|
protected boolean |
entityNamesInUse
|
protected static DbOrm |
orm
|
protected java.lang.String[] |
primitiveEntitiesPrefixes
|
protected java.lang.String |
tablePrefix
|
Constructor Summary | |
---|---|
protected |
DbOrm()
Singleton. |
Method Summary | |
---|---|
void |
clearDescriptorsCache()
Clears descriptors cache. |
java.lang.String |
getColumnAliasSeparator()
Returns value for separator for column aliases that divides table reference and column name. |
static DbOrm |
getInstance()
Returns current DB-ORM instance. |
java.lang.String[] |
getPrimitiveEntitiesPrefixes()
|
java.lang.String |
getTablePrefix()
Returns current table prefix. |
int |
getTotalNames()
Return total number of entity names. |
int |
getTotalTypes()
Returns total number of registered types. |
boolean |
isEntityNamesInUse()
Returns true if entity names are cached. |
DbEntityDescriptor |
lookupName(java.lang.String typeName)
Lookups for DbEntityDescriptor that was registered with this DbOrm. |
DbEntityDescriptor |
lookupType(java.lang.Class type)
Lookups for DbEntityDescriptor and registers it if type is new. |
DbEntityDescriptor |
register(java.lang.Class type)
Registers entity type. |
void |
setColumnAliasSeparator(java.lang.String separator)
Specifies separator for column aliases that divides table reference and column name. |
void |
setEntityNamesInUse(boolean entityNamesInUse)
Sets if entity names should be cached. |
static void |
setInstance(DbOrm orm)
Sets new default instance for DB-ORM mapper. |
void |
setPrimitiveEntitiesPrefixes(java.lang.String[] primitiveEntitiesPrefixes)
|
DbOrm |
setTablePrefix(java.lang.String prefix)
Sets default table prefix for all tables. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static DbOrm orm
protected java.lang.String tablePrefix
protected boolean entityNamesInUse
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.lang.String columnAliasSeparator
public static ColumnAliasType DEFAULT_COLUMN_ALIAS_TYPE
Constructor Detail |
---|
protected DbOrm()
Method Detail |
---|
public static DbOrm getInstance()
public static void setInstance(DbOrm orm)
null
current instance will be replaced
with new instance of this class.
public DbOrm setTablePrefix(java.lang.String prefix)
public java.lang.String getTablePrefix()
public boolean isEntityNamesInUse()
true
if entity names are cached.
public void setEntityNamesInUse(boolean entityNamesInUse)
public java.lang.String[] getPrimitiveEntitiesPrefixes()
public void setPrimitiveEntitiesPrefixes(java.lang.String[] primitiveEntitiesPrefixes)
public DbEntityDescriptor lookupType(java.lang.Class type)
DbEntityDescriptor
and registers
it if type 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 DbEntityDescriptor register(java.lang.Class type)
entity names is in use
then type names will be
associated to parsed data as well.
public DbEntityDescriptor lookupName(java.lang.String typeName)
DbEntityDescriptor
that was registered with this DbOrm.
Returns null
if name not found.
public int getTotalNames()
public int getTotalTypes()
public void clearDescriptorsCache()
public java.lang.String getColumnAliasSeparator()
public void setColumnAliasSeparator(java.lang.String separator)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |