iBATIS is a hybrid solution. It takes the best ideas from other solutions and creates synergy between them.
It takes SQL out of the source code and into a place where we can work with it more naturally,we need to link it back to the software so that it can be executed in a way that is useful.
iBATIS uses Extensible Markup Language(XML) to encapsulate SQL. Using XML< iBATIS maps the inputs and outputs of the statement. Most SQL statements have one or more parameters and produce some sort of tabulated results. That is, results are organized into a series of columns and rows. iBATIS allows you to easily map both parameters and results to properties of objects. Consider the next example:
<select id="categoryById" parameterClass="string" resultClass="category">
SELECT CATEGORYID, NAME, DESCRIPTION
FROM CATEGORY
WHERE CATEGORYID = #categoryId#
</select>
Notice the XML element surrounding the SQL. This is the encapsulation of the SQL. The simple <select> element defines the name of the statement, the parameter input type, and the resulting output type. To an object-oriented software developer, this is much like a method signature.
Both simplificity and consistency are achieved through externalizing and encapsulating the SQL.
It takes SQL out of the source code and into a place where we can work with it more naturally,we need to link it back to the software so that it can be executed in a way that is useful.
iBATIS uses Extensible Markup Language(XML) to encapsulate SQL. Using XML< iBATIS maps the inputs and outputs of the statement. Most SQL statements have one or more parameters and produce some sort of tabulated results. That is, results are organized into a series of columns and rows. iBATIS allows you to easily map both parameters and results to properties of objects. Consider the next example:
<select id="categoryById" parameterClass="string" resultClass="category">
SELECT CATEGORYID, NAME, DESCRIPTION
FROM CATEGORY
WHERE CATEGORYID = #categoryId#
</select>
Notice the XML element surrounding the SQL. This is the encapsulation of the SQL. The simple <select> element defines the name of the statement, the parameter input type, and the resulting output type. To an object-oriented software developer, this is much like a method signature.
Both simplificity and consistency are achieved through externalizing and encapsulating the SQL.
Comments
Post a Comment