This is a feature available in iBatis but it is not mentioned in the documentation. You can find the example in the iBatis source code under the unit tests.
Let’s said I need to run the following SQL statement
select * from my_table where col_1 in ('1','2','3')
So how do I pass in the values of 1, 2 and 3 ?
In this case you need to pass in a list parameter. The correct iBatis syntax should be
<select id="select-test" resultMap="MyTableResult"
parameterClass="list">
select * from my_table where col_1 in
<iterate open="(" close=")" conjunction=",">
#[]#
</iterate>
</select>
And in Java you should pass in a java.util.List. E.g.
List<String> list = new ArrayList<String>(3);
list.add("1");
list.add("2");
list.add("3");
List objs = sqlMapClient.queryForList("select-test",list);
This is another example
<select id="getProducts" parameterClass="Product"
resultClass="Product">
SELECT * FROM Products
<dynamic prepend="WHERE productType IN ">
<iterate property="productTypes"
open="(" close=")"
conjunction=",">
productType=#productType#
</iterate>
</dynamic>
</select>
…
Search Blog
Sunday, January 9, 2011
Ibatis Dynamic SQL
Monday, August 2, 2010
mysql ornek create
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
);
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
);
Saturday, May 8, 2010
mysql id primary key auto-increment convert
alter table proddeploymenttree modify id int(10) not null auto_increment PRIMARY KEY
Sunday, April 25, 2010
Websitesine Favicon ekleme
A favicon (short for favorites icon), also known as a website icon, shortcut icon, url icon, or bookmark icon is a 16×16, 32×32 or 64×64 pixel square icon associated with a particular website or webpage.[1] A web designer can create such an icon and install it into a website (or webpage) by several means, and most graphical web browsers will then make use of it.
<"link" rel="icon" type="image/png" href="http://example.com/image.png">
buradan generate edebilirsin : http://www.favicon.cc/
<"link" rel="icon" type="image/png" href="http://example.com/image.png">
buradan generate edebilirsin : http://www.favicon.cc/
Friday, April 16, 2010
MySQL IBatis te insertten sonra auto_increment key i dönmek
SELECT LAST_INSERT_ID() AS value
INSERT INTO
deploymenttree(name,devdeploymentid,proddeploymentid,parentId)
VALUES(
#name#,#devDeploymentId#,#prodDeploymentId#,#parentId# )
Subscribe to:
Posts (Atom)