ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Please Help in arguing for iBatis SqlMaps
Date Fri, 08 Apr 2005 03:16:43 GMT
Heheheh, this is funny.

OK, here is an iBATIS application. 

It is not the best example, but it shows how nonsensical this statement is: 
"For small project SqlMap is adding unnecessary complexity."

package blah;

import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.common.resources.Resources;
import java.io.Reader;
import java.util.List;

public class Main {
public static void main(String arg[]) throws Exception {
String resource;
Reader reader;
List list;
SqlMapClient sqlMap;
resource = "blah/SqlMapConfig.xml";
reader = Resources.getResourceAsReader (resource);
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
list = sqlMap.queryForList("getAll", null);
System.out.println("Selected " + list.size() + " records.");
for(int i = 0; i < list.size(); i++) {

OH! I almost forgot the configuration files!

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
<settings cacheModelsEnabled="true"
lazyLoadingEnabled="true" maxRequests="32"
maxSessions="10" maxTransactions="5"
useStatementNamespaces="false" />
<transactionManager type="JDBC" >
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
<property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost/test"/>
<property name="JDBC.Username" value="root"/>
<property name="JDBC.Password" value=""/>
<sqlMap resource="org/apache/mapper2/ii15/SqlMap.xml" />

And here is the second one:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
<sqlMap namespace="ii15">
<select id="getAll" resultClass="java.util.HashMap">
select * from user

Now, where is the complexity?

I think brandon may have hit the nail on the head...who wrote the framework 
that your peer wants to use?


View raw message