Ibatis 2.0 instructions (2) - Configuration articles (2) [original]

xiaoxiao2021-03-06  66

The label included in SQLMAP:

id

ParameterClass

Resultclass

Parametermap

Resultmap

Cachemodel All Dynamic Elements All Query Methods

id

ParameterClass

Resultclass

Parametermap

Resultmap

XmlResultname

All Dynamic Elements

insert

Update

Delete

All Query Methods

[parameterclass = "some.class.name"]

[Resultclass = "some.class.name"]

[parametermap = "nameofparametermap"]

[ResultMap = "nameofresultmap"]

[cachemodel = "nameofcache"]]

>

Select * from product where prd_id = [? | # protyname #] Order by [$ SimpleNami]

2. THE SQL

The SQL statement is undoubtedly the most important part of the Map, and you can use any SQL statement, as long as your database and JDBC drive support. You can also use any functions supported by the database and drive. Because you write the SQL statement in the XML document, in order to distinguish "<>" in the SQL, "<>" in XML in SQL, you can write to write.

3. Self-increased

Many relational databases support from the self-increment of primary keys, SQL Map can support from in the tab. Prechase (such as Oracle) and after generating (such as SQL Server) support, the following is example:

Select stockidsequence.nextVal as id from dual

INSERT INTO PRODUCT (prd_id, prd_description) values ​​(#ID #, # description #)

INSERT INTO PRODUCT (prd_description) Values ​​(# description #)

SELECT @@ identity as id

4. Store procedure:

The stored procedure is supported by the tag, and the following example shows how to use the stored procedure with output parameters.

{CALL SWAP_EMAIL_ADDRESS (?,?)}

Calling the above stored procedure switches the Email address between the two columns of the data table, and also exchanges in the corresponding parameter object. Remember: When parameter mapping Mode is inout or out,

The parameter object you entered will change. Obviously, the invariant parameter object will not change, such as String objects.

转载请注明原文地址:https://www.9cbs.com/read-120628.html

New Post(0)