Hi all
i'm new to Ibatis and i'm reading "Ibatis in action" Book but i've a No
statetement problem...
so i've these files:
sqlMapConfig.xml
---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config
2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd ">
<sqlMapConfig>
<properties resource="com/magoscuro/ibatis/dati.properties"/>
<transactionManager type="JDBC" >
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name=" JDBC.Username" value="${user}"/>
<property name="JDBC.Password" value="${password}"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/magoscuro/ibatis/SqlMap.xml" />
</sqlMapConfig>
---
SqlMap.xml
---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0 //EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
<select id="getAllAccountIdValue" resultClass="int">
select count(USERID) from USER_ACCOUNT
</select>
<select id="getAllUsers" parameterClass="string" resultClass="hashmap">
SELECT * FROM USER_ACCOUNT WHERE GROUPNAME = #groupName#
</select>
</sqlMap>
---
and finally my java file:
---
public static void main(String[] args) throws Exception {
String resource = "com/magoscuro/ibatis/SqlMapConfig.xml";
Reader reader = Resources.getResourceAsReader(resource);
SqlMapClient sqlMap =
SqlMapClientBuilder.buildSqlMapClient(reader);
List list = sqlMap.queryForList("getAllUsers","EMPLOYEE");
System.out.println("Selected " + list.size() + " records");
for (int i=0; i<list.size(); i++){
System.out.println(list.get(i));
}
}
---
Ok it work very well but i've read in the book that i can use dot
notation, for example Account.gettAllUsers ok now is the problem...how
can i use this dot notation? :D
thank in advance
--
Giovanni D'Addabbo
http://www.magoscuro.com