XML structure
Below is the XML configuration structure.
Element <broker>
The broker element is the root element of a Broker definition.
Attributes
- nameunique broker name
- Contains the unique name of the Broker. This is for distinction when working with multiple Brokers.
- version"2.0"
- Specifies what version of configuration file is used.
- catalogcatalog name
- Catalog name.
- transaction-isolationtransaction isolation level
- The default transaction isolation level. Available levels:
- TRANSACTION_NONE
- TRANSACTION_READ_UNCOMMITTED
- TRANSACTION_READ_COMMITTED
- TRANSACTION_REPEATABLE_READ
- TRANSACTION_SERIALIZABLE
- lazy-load[true | false]
- Default for all sub-query elements. Are only applied to sub-queries that are mapped to a
java.util.Collection interface or sub-interface.
Child elements
Element <sql-statement>
Define any SQL statement.
Attributes
- idunique id
- Name of sql-statement.
- external-sourcefile name
- Name of external file that contains the SQL statement.
- result-objectresult-object id
- Name of the result-object to map the SQL statement result set to.
Child elements
Element <append-statement>
Append a SQL statement with additional behavior. This becomes a new unique statement.
Attributes
- id-suffixid suffix
- Suffix appended to sql-statement id for a unique full sql-statement id.
- result-objectresult-object id
- Name of the result-object to map the appended SQL statement result set to. Defaults to parent.
Element <result-object>
A result object is a one-way mapping definition from a SQL query to a Java object.
Attributes
- idunique id
- Name of result-object.
- classclass name
- Any fully qualified Java class name.
- extendsresult-object id
- Name of result-object to extend. Useful for class inheritance.
- key-columnscolumn names
- Separated list of unique key column names. Required for all instantiable classes. This does not have to be the primary key, but most often would be. Use value
"*" if there are no columns that can represent a key.
Child elements
Element <constructor>
Constructor of class to be used for mapping. Not necessary for no-arg constructors.
Element <factory-method>
Alternative to constructor. Must be a static method that returns an object of the same class as declared for result-object
Attributes
- namemethod name
- Name of static factory method.
Child elements
Element <argument>
Constructor or method argument. If there are multiple constructors or overloaded methods with the same number of arguments, a class attribute is necessary to resolve ambiguitites.
Attributes
- classclass name
- Argument class name. Must be fully qualified. Can be supplied to resolve ambiguities.
Child elements
Element <property>
Property to me mapped to. This is any one-argument method with a prefix of setXXX.
Attributes
- nameproperty name
- Name of property.
Child elements
Element <method>
Use method for mapping object attributes. This can be used for an arbitrary number of argurments.
Attributes
- namemethod name
- Name of method.
Child elements
Element <field>
Field to map directly to.
Attributes
- namefield name
- Name of field.
Child elements
Element <column>
The column to use for mapping. If mapping from a stored procedure, use parameter index.
Attributes
- namecolumn name
- Name or index of column or parameter.
Element <map-with>
Use other result-object to map with.
Attributes
- result-objectresult-object id
- Id of result object.
Child elements
Element <column-alias>
Define an alias for a column if the column name from query is different than the column name defined in the result-object mapping. This is useful for resolving column name clashes on JOIN queries.
Attributes
- query-columncolumn name
- Query column name or index.
- mapped-columncolumn name
- Mapped column name or index. Name of the column used in the result-object referenced on the map-with parent element.
Element <sub-query>
Use a sub query to map this property. Can map to either single objects or collections, although it is recommended to use JOIN queries along with map-with element for one-to-one mappings.
Attributes
- sql-statementname of statement
- Name of the sql-statement.
- lazy-load["true" | "false"]
- Defines if the collection should be lazily fetched. This overrides the lazy-load attribute on the broker element.
Child elements
Element <set-parameter>
Set parameter on SQL statement for a sub-query.
Attributes
- nameparameter name
- Name of the parameter to set.
- from-columncolumn name
- Name of column from current query.
Element <delegate-mapping>
Delegate mapping of result-object. This is most often used in inheritance hierarchies where a discriminator is used to determine delegation of mapping to a subclass.
Attributes
- use-columncolumn name
- Name of the discriminator column to evaluate for delegation.
Child elements
Element <delegate-to>
Result-object to delegate mapping to. This is typically a subclass of the result-object containing this delegation.
Attributes
- result-objectresult-object id
- Name of result-object to delegate to.
- on-valueany value
- The value that triggers delegation.