Namespace URI: http://www.xchain.org/hibernate/1.0
This namespace provides access to hibernate. A hibernate.cfg.xml must be present to properly establish a connection to a datasource.
Most hibernate commands are required to be within an active session .
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName | |
message | org.xchain.annotations.AttributeType.ATTRIBUTE_VALUE_TEMPLATE | String |
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName | |
select | An XPath to the entity to delete. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | Object |
select-nodes | An XPath to a list of entities to delete. | org.xchain.annotations.AttributeType.JXPATH_SELECT_NODES | N/A | List |
select-single-node | An XPath to a the entity to delete. | org.xchain.annotations.AttributeType.JXPATH_SELECT_SINGLE_NODE | N/A | Object |
The delete command deletes the provided entity or list of entities.
This must reference an active session .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> ... <xchain:delete select="/some/xpath"/> ... </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
query | The location of the query to use. | org.xchain.annotations.AttributeType.JXPATH_VALUE | $hibernate:query | Query |
start | The start index to retrieve results. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | Integer |
The first-result command sets the FirstResult on the parent Query.
This must reference a query .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'from entity'"> ... <xchain:first-result start="'10'"/> ... </xchain:query> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName | |
id | ID of the entity to retrieve. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | Serializable |
class-name | The class of the entity to retrieve. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
result | Where to store the retrieved entity. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
variable | Variable of where to store the entity. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
scope | Scope of the variable storing the entity. | org.xchain.annotations.AttributeType.LITERAL | execution | Scope |
The get command starts executes the Get method on the current session. The class-name attribute identifies the class to be loaded. The id attribute identifies the unique identifier for the class to be loaded.
This must reference an active session .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:get id="'1'" class-name="'my.package.entity'" variable="result" scope="request"/> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
query | The location of the query to use. | org.xchain.annotations.AttributeType.JXPATH_VALUE | $hibernate:query | Query |
result | The QName of where to store the result. The QName must already exist. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
variable | The variable of where to store the result. If the variable does not yet exist, a variable will be declared. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
scope | The scope of the variable. | org.xchain.annotations.AttributeType.LITERAL | execution | Scope |
The iterate evaluates the Query as an iterator.
This must reference a query .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'from Entity'"> ... <xchain:iterate result="$myIterator"/> ... </xchain:query> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
query | The location of the query to use. | org.xchain.annotations.AttributeType.JXPATH_VALUE | $hibernate:query | Query |
result | The QName of where to store the result. The QName must already exist. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
variable | The variable of where to store the result. If the variable does not yet exist, a variable will be declared. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
scope | The scope of the variable. | org.xchain.annotations.AttributeType.LITERAL | execution | Scope |
The list evaluates the Query as a list.
This must reference a query .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'from Entity'"> ... <list result="$myList"/> ... </xchain:query> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
query | The location of the query to use. | org.xchain.annotations.AttributeType.JXPATH_VALUE | $hibernate:query | Query |
size | The maximum number of entries. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | Integer |
The max-result command sets the MaxResults on the parent Query.
This must reference a query .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'from entity'"> ... <xchain:max-result start="'10'"/> ... </xchain:query> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
query | The location of the query to use. | org.xchain.annotations.AttributeType.JXPATH_VALUE | $hibernate:query | Query |
name | The name of the parameter in the query. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
value | The value of the parameter in the query. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | Object |
The parameter command will specify a parameter for a query.
This must reference a query .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'from entity where value = :myvalue'"> ... <xchain:parameter name="'myvalue'" value="/some/xpath"/> ... </xchain:query> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName | |
entity | The entity to persist. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
The persist command will execute a Hibernate persist on the session with the specified entity. For more information about the persist method, refer to the Hibernate documentation.
This must reference an active session .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:persist entity="$myEntity"> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName | |
result | Where the query is stored. | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate/1.0}query | QName |
query | The actual HQL query. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
The query command starts a new query.
This must reference an active session .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'from entity'"> ... <xchain:query/> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName | |
entity | The entity to save. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
The save command will execute a Hibernate save on the session with the specified entity. For more information about the save method, refer to the Hibernate documentation.
This must reference an active session .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:save entity="$myEntity"> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
result | Where the session is stored. | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate/1.0}session | QName |
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName |
NOTE: The hibernate session command is currently broken. This implementation will create duplicate sessions when used with the HibernateLifecycle.getCurrentSession() function. This tag will be removed in the 0.4.0 version of XChains.
The session command creates a new Hibernate session and stores it into the context. The location of the session in the context is determined by the result attribute.
Once the session command is complete, the Hibernate session will be closed.
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> ... </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
timeout | The timeout of queries on this transaction in seconds. | org.xchain.annotations.AttributeType.JXPATH_VALUE | \90\ | Integer |
propagate-result | Whether to continue the chain of command based on the children's result. | org.xchain.annotations.AttributeType.JXPATH_VALUE | \false\ | Boolean |
name | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate}session-factory | QName |
The transaction command starts a Hibernate transaction. Any children commands will be run within the context of this transaction. When all children commands have been executed, the transaction will be committed unless any exceptions are thrown up to this command. If an unhandled exception is encountered the transaction will be rolled back.
If the propagate-result attribute is true then the chain of command will continue if and only if the children commands would continue the chain of command. If the propagate-result attribute is false then the chain of command will continue regardless of the result of the children commands.
This must reference an active session .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
query | The location of the query to use. | org.xchain.annotations.AttributeType.JXPATH_VALUE | $hibernate:query | Query |
result | The QName of where to store the result. The QName must already exist. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
variable | The variable of where to store the result. If the variable does not yet exist, a variable will be declared. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
scope | The scope of the variable. | org.xchain.annotations.AttributeType.LITERAL | execution | Scope |
The unique-result evaluates a query as a uniqueResult.
This must reference a query .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'from Entity where value = 1'"> ... <unique-result result="$myEntity"/> ... </xchain:query> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
query | The location of the query to use. | org.xchain.annotations.AttributeType.JXPATH_VALUE | $hibernate:query | Query |
result | The QName of where to store the result. The QName must already exist. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
variable | The variable of where to store the result. If the variable does not yet exist, a variable will be declared. | org.xchain.annotations.AttributeType.QNAME | N/A | String |
scope | The scope of the variable. | org.xchain.annotations.AttributeType.LITERAL | execution | Scope |
The update executes the query as an update.
This must reference a query .
<xchain:session xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:transaction> ... <xchain:query query="'update Entity set value = 1 where value = 1'"> ... <xchain:update result="$myEntity"/> ... </xchain:query> ... </xchain:transaction> </xchain:session>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
select | The entity to validate. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | Object |
select-nodes | A list of entities to validate. | org.xchain.annotations.AttributeType.JXPATH_SELECT_NODES | N/A | List |
select-single-node | The entity to validate. | org.xchain.annotations.AttributeType.JXPATH_SELECT_SINGLE_NODE | N/A | Object |
validation-messages | Where to store the validation messages. | org.xchain.annotations.AttributeType.QNAME | {http://www.xchain.org/hibernate/1.0}validation-messages | QName |
The validate command ensures that objects have their proper hibernate restrictions. If the objects are valid then the child valid command is executed. If the objects are invalid then the child invalid command is executed.
<xchain:validate select="/some/xpath" xmlns:xchain="http://www.xchain.org/hibernate/1.0"> <xchain:valid> ... </xchain:valid> <xchain:invalid> ... </xchain:invalid> </xchain:session>