Java Reference
In-Depth Information
Table 5.1
Mapped statement types for updating data (and related XML elements) (continued)
Mapped
statement type
Attributes
Child elements
Uses
More details
<sql>
id
All dynamic elements
Not really a mapped state-
ment, but used to make
components that can be
used in mapped state-
ments
Section 4.2;
chapter 8
<include>
refid
None
Not really a mapped state-
ment, but used to insert
components created with
the <sql> type into
mapped statements
Section 4.2
For more information on the <sql> and <include> elements, refer to section 4.1.3
in the previous chapter.
Now that you have the building blocks, let's look at how you can put them
together.
5.2 I nserting data
Inserting data into your database is not exactly the same as selecting data, but the
process is very similar. Regardless of whether you use inline or external parameter
mapping (both of which are explained in detail in the previous chapter—see sec-
tions 4.3.1 and 4.3.2), they work just like they do with all other mapped statements.
5.2.1
Using inline parameter mapping
Inline parameter mapping lets you very quickly build your mapped statements by
providing hints in your markup that tell i BATIS how you want it to map your input
to your mapped statement. Here is an example of an insert statement using
inline parameter mapping:
<insert id="insertWithInlineInfo">
insert into account (
accountId,
username, password,
memberSince,
firstName, lastName,
address1, address2,
city, state, postalCode,
country, version
) values (
Search WWH ::




Custom Search