Klasse DatabaseMap
- Alle implementierten Schnittstellen:
Serializable
- Version:
- $Id: DatabaseMap.java 1917245 2024-04-21 14:06:23Z tv $
- Autor:
- John D. McNally, Daniel Rall, Greg Monroe
- Siehe auch:
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final String
Format used to create create the class name for initializing a DB specific mapstatic final char
The character which separates the schema name from the table name.static final char
The character used by most implementations as the separator between name elements. -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungAdd a new table to the database by name.boolean
containsTable
(String name) Does this database contain this specific table?boolean
containsTable
(TableMap table) Does this database contain this specific table?void
copyFrom
(DatabaseMap databaseMap) Copy all settings except the database from another database map.getName()
The name of the database to which this database map belongs.Get a TableMap for the table by name.TableMap[]
Get a TableMap[] of all of the tables in the database.void
Fully populate this DatabaseMap with all the TablesMaps.protected String
javanameMethod
(String schemaName) Converts a database schema name to java object name.void
setIdTable
(TableMap idTableMap) Add a new TableMap to the database.toString()
Von Klasse geerbte Methoden org.apache.torque.map.OptionSupport
clearOptions, getOption, getOptions, setOption
-
Felddetails
-
STD_SEPARATOR_CHAR
public static final char STD_SEPARATOR_CHARThe character used by most implementations as the separator between name elements.- Siehe auch:
-
SCHEMA_SEPARATOR_CHAR
public static final char SCHEMA_SEPARATOR_CHARThe character which separates the schema name from the table name.- Siehe auch:
-
INIT_CLASS_NAME_FORMAT
Format used to create create the class name for initializing a DB specific map- Siehe auch:
-
-
Konstruktordetails
-
DatabaseMap
Constructs a new DatabaseMap.- Parameter:
database
- the databsae to map- Löst aus:
NullPointerException
- if the database is not provided
-
-
Methodendetails
-
getName
The name of the database to which this database map belongs.- Gibt zurück:
- the database name, not null.
-
containsTable
Does this database contain this specific table?- Parameter:
table
- The TableMap representation of the table.- Gibt zurück:
- True if the database contains the table.
-
containsTable
Does this database contain this specific table?- Parameter:
name
- The String representation of the table.- Gibt zurück:
- True if the database contains the table.
-
getTable
Get a TableMap for the table by name.Note that by default Torque uses lazy initialization to minimize memory usage and startup time. However, if an OM or PEER class has not called the table's MapBuilder class, it will not be here. See the optional initialize method if you need full OM Mapping.
- Parameter:
name
- Name of the table.- Gibt zurück:
- A TableMap, null if the table was not found.
-
getTables
Get a TableMap[] of all of the tables in the database.Note that by default Torque uses lazy initialization to minimize memory usage and startup time. However, if an OM or PEER class has not called the table's MapBuilder class, it will not be here. See the optional initialize method if you need full OM Mapping.
- Gibt zurück:
- A TableMap[].
-
addTable
Add a new table to the database by name. It creates an empty TableMap that you need to populate.- Parameter:
tableName
- The name of the table.- Gibt zurück:
- the new table map.
-
setIdTable
Add a new TableMap to the database.- Parameter:
idTableMap
- The TableMap representation.
-
initialize
Fully populate this DatabaseMap with all the TablesMaps. This is only needed if the application needs to use the complete OM mapping information. Otherwise, the OM Mapping information will be populated as needed by OM and Peer classes. An example of how to initialize the map info from the application:DatabaseMap dbMap = Torque.getDatabaseMap( dbName ); try { dbMap.initialize(); } catch ( TorqueException e ) { ... error handling }
Note that Torque database names are case sensitive and this DB map must be retrieved with the exact name used in the XML schema.This uses Java reflection methods to locate and run the init() method of a class generated in the org.apache.torque.linkage package with a name based on the XML Database name value, e.g. org.apache.torque.linkage.DefaultMapInit
Some misconfiguration situations that could cause this method to fail are:
The class(es) in the org.apache.torque.linkage package were not included with the other generated class files (e.g. the jar file creation process only included com.* and not org.* files).
- Löst aus:
TorqueException
- If an error is encountered locating and calling the init method.
-
javanameMethod
Converts a database schema name to java object name. Operates same as underscoreMethod but does not convert anything to lowercase. This must match the javaNameMethod in the JavaNameGenerator class in Generator code.- Parameter:
schemaName
- name to be converted.- Gibt zurück:
- converted name.
-
copyFrom
Copy all settings except the database from another database map.- Parameter:
databaseMap
- the database map to copy from, not null.
-
toString
-