Skip to main content

Document Structure

Mapper files are stored as XML. The basic structure is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//dbvisitor.net//DTD Mapper 1.0//EN"
"https://www.dbvisitor.net/schema/dbvisitor-mapper.dtd">
<mapper namespace="...">
...
</mapper>

Attributes​

PropertyDescription
namespaceRequired Usually the fully qualified mapper interface name; each method maps to a SQL operation in this file.
caseInsensitiveOptional Case-insensitive matching for column/property names. Default true. Handy when drivers return uppercase cols.
mapUnderscoreToCamelCaseOptional Convert camelCase properties to snake_case column names (e.g., createTime → create_time). Default false.
autoMappingOptional Enable auto-mapping. Default true.
useDelimitedOptional (v5.3.4+) Force quoting/delimiters on table/column names when generating SQL. Default false.

Tags​

Top-level XML elements available under the root:

Validate the Document​

Use XML DTD or XML Schema to validate mapper XML.

Example: validate with DTD
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//dbvisitor.net//DTD Mapper 1.0//EN"
"https://www.dbvisitor.net/schema/dbvisitor-mapper.dtd">
<mapper namespace="...">
...
</mapper>
Example: validate with XML Schema
<?xml version="1.0" encoding="UTF-8"?>
<mapper xmlns="https://www.dbvisitor.net/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.dbvisitor.net/schema https://www.dbvisitor.net/schema/dbvisitor-mapper.xsd"
namespace="...">
...
</mapper>