iBATIS.NET - DataMapper Application Framework

DataMapper Developer Guide

Ted Husted

Gilles Bayon

Clinton Begin

Roberto Rabe

Version 1.6.1

Legal Notice

March 2007


1. Introduction
1.1. Overview
1.2. What's covered here
1.3. Release change log
1.4. License Information
1.5. Support
1.6. Disclaimer
2. The Big Picture
2.1. Introduction
2.2. What does it do?
2.3. How does it work?
2.4. Is iBATIS the best choice for my project?
3. Working with Data Maps
3.1. Introduction
3.2. What's in a Data Map definition file, anyway?
3.3. Mapped Statements
3.3.1. Statement Types
3.3.2. Stored Procedures
3.3.3. The SQL
3.3.3.1. Reusing SQL Fragments
3.3.3.2. Escaping XML symbols
3.3.3.3. Auto-Generated Keys
3.3.3.4. <generate> tag
3.3.3.4.1. <generate> tag attributes
3.3.4. Statement-type Element Attributes
3.3.4.1. id
3.3.4.2. parameterMap
3.3.4.3. parameterClass
3.3.4.4. resultMap
3.3.4.5. resultClass
3.3.4.6. listClass
3.3.4.7. cacheModel
3.3.4.8. extends
3.4. Parameter Maps and Inline Parameters
3.4.1. <parameterMap> attributes
3.4.1.1. id
3.4.1.2. class
3.4.1.3. extends
3.4.2. <parameter> Elements
3.4.2.1. property
3.4.2.2. column
3.4.2.3. direction
3.4.2.4. dbType
3.4.2.5. type
3.4.2.6. nullValue
3.4.2.7. size
3.4.2.8. precision
3.4.2.9. scale
3.4.2.10. typeHandler
3.4.3. Inline Parameter Maps
3.4.4. Standard Type Parameters
3.4.5. Map or IDictionary Type Parameters
3.5. Result Maps
3.5.1. Extending resultMaps
3.5.2. <resultMap> attributes
3.5.2.1. id
3.5.2.2. class
3.5.2.3. extends
3.5.2.4. groupBy
3.5.3. <constructor> element
3.5.3.1. argumentName
3.5.3.2. column
3.5.3.3. columnIndex
3.5.3.4. dbType
3.5.3.5. type
3.5.3.6. resultMapping
3.5.3.7. nullValue
3.5.3.8. select
3.5.3.9. typeHandler
3.5.4. <result> Elements
3.5.4.1. property
3.5.4.2. column
3.5.4.3. columnIndex
3.5.4.4. dbType
3.5.4.5. type
3.5.4.6. resultMapping
3.5.4.7. nullValue
3.5.4.8. select
3.5.4.9. lazyLoad
3.5.4.10. typeHandler
3.5.5. Custom Type Handlers
3.5.6. Inheritance Mapping
3.5.7. Implicit Result Maps
3.5.8. Primitive Results (i.e. String, Integer, Boolean)
3.5.9. Maps with ResultMaps
3.5.10. Complex Properties
3.5.11. Avoiding N+1 Selects (1:1)
3.5.12. Complex Collection Properties
3.5.13. Avoiding N+1 Select Lists (1:M and M:N)
3.5.14. Composite Keys or Multiple Complex Parameters Properties
3.6. Supported Types for Parameter Maps and Result Maps
3.7. Supported database types for Parameter Maps and Result Maps
3.8. Cache Models
3.8.1. Read-Only vs. Read/Write
3.8.2. Serializable Read/Write Caches
3.8.3. Cache Implementation
3.8.4. "MEMORY"
3.8.5. "LRU"
3.8.6. "FIFO"
3.9. Dynamic SQL
3.9.1. Binary Conditional Elements
3.9.1.1. Binary Conditional Attributes:
3.9.2. Unary Conditional Elements
3.9.2.1. Unary Conditional Attributes:
3.9.3. Parameter Present Elements
3.9.3.1. Parameter Present Attributes:
3.9.4. Iterate Element
3.9.4.1. Iterate Attributes:
3.9.5. Simple Dynamic SQL Elements
4. .NET Developer Guide
4.1. Introduction
4.2. Installing the DataMapper for .NET
4.2.1. Setup the Distribution
4.2.2. Add Assembly References
4.2.3. Add XML File Items
4.2.4. Visual Studio.NET Integration
4.3. Configuring the DataMapper for .NET
4.3.1. DataMapper clients
4.3.2. DataMapper Configuration File (SqlMap.config)
4.3.3. DataMapper Configuration Elements
4.3.3.1. The <properties> Element
4.3.3.1.1. <properties> attributes
4.3.3.1.2. <property> element and attributes
4.3.3.2. The <providers> Element
4.3.3.2.1. <providers> attributes
4.3.3.3. The <settings> Element
4.3.3.4. The <typeAlias> Element
4.3.3.4.1. <typeAlias> attributes
4.3.3.4.1.1. type Attribute
4.3.3.4.2. Predefined type aliases
4.3.3.5. The <typeHandler> Element
4.3.3.5.1. <typeHandler> attributes
4.3.3.6. The <database> Element
4.3.3.6.1. The <provider> Element
4.3.3.6.2. The <datasource> element
4.3.3.7. The <sqlMap> Element
4.4. Programming with iBATIS DataMapper: The .NET API
4.4.1. Building a SqlMapper Instance
4.4.1.1. Multiple Databases
4.4.1.2. DomSqlMapBuilder Configuration Options
4.4.1.3. DomSqlMapBuilder : Advanced settings
4.4.2. Exploring the DataMapper API through the SqlMapper
4.4.2.1. Insert, Update, Delete
4.4.2.2. QueryForObject
4.4.2.3. QueryForList
4.4.2.4. QueryWithRowDelegate
4.4.2.5. QueryForMapWithRowDelegate
4.4.2.6. QueryForPaginatedList
4.4.2.7. QueryForDictionary, QueryForMap
4.4.3. Session
4.4.4. Connection
4.4.5. Automatic Session
4.4.6. Transaction
4.4.7. Distributed Transactions
4.4.8. Coding Examples [TODO: Expand in to a Cookbook of practical examples]
4.5. Logging SqlMap Activity
4.5.1. Sample Logging Configurations
A. iBATIS.NET's SqlMapConfig.xsd
B. iBATIS.NET's SqlMap.xsd