...
The typical structure of the Logical Data Source configuration XML is as follows. More detailed configuration options for the Logical Data Source can be found in the iBatis documentation references provided earlier.
Code Block |
---|
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<properties resource="myenvironment.properties" />
<transactionManager type="EXTERNAL">
<property name="SetAutoCommitAllowed" value="false"/>
<dataSource type="JNDI">
<property name="DataSource" value="${MY_DATASOURCE}"/>
</dataSource>
</transactionManager>
<!-- Default_SqlMap.xml file import should be at the top of all xmls, because this file will handle the app's filtering and pagination -->
<sqlMap resource="com/intellectdesign/canvas/database/ibatis/${CT_DATABASE_VENDOR}/maps/viewdefn/Default_SqlMap.xml"/>
<sqlMap resource="maps/grid/myWidgetView_SqlMap.xml"/>
<sqlMap resource="maps/calendar/myCalendarView_SqlMap.xml"/>
</sqlMapConfig>
|
...
- It is possible to dynamically inject values into the configuration XML based on a property file. In this example, myenvironment.properties is a property file that belongs to the end application having 2 keys MY_DATASOURCE and MH_VENDOR that corresponds to the JNDI name and the Database vendor configured for the framework.
- iBatis uses ANT style place holders for placing dynamic content referenced from the property file attached. The typical construct is ${place holder}. Hence to use MY_DATASOURCE as a placeholder, refer it as ${MY_DATASOURCE}.
- The key expectation from a Logical Data Source configuration is to include the Framework provided SQL Map as the first map. This SQL map provides standard placeholders, conventions or patterns that need to be used for functionality like runtime filtering, sorting, paging, etc. This is typically in the resource path -
Code Block |
---|
|
com/intellectdesign/canvas/database/ibatis/${CT_DATABASE_VENDOR}/maps/viewdefn/Default_SqlMap.xml |
Highlightinfo |
---|
|
The placeholder CT_DATABASE_VENDOR is a default placeholder that is made available for the Logical Data Source to be use. This corresponds to the configuration provided under the CT_FW_DATABASE_VENDOR key as part of the Canvas Initialization configuration. |
View the following pages
Page Tree |
---|
root | Creating a Logical Data Source |
---|
|