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."

===
Main.java
===
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.");
        System.out.println("--------------------");
        for(int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        System.out.println("--------------------");
    }
}
===

OH! I almost forgot the configuration files!

===
SqlMapConfig.xml
===
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
    PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
  <settings cacheModelsEnabled="true"
    enhancementEnabled="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=""/>
    </dataSource>
  </transactionManager>
  <sqlMap resource="org/apache/mapper2/ii15/SqlMap.xml" />
</sqlMapConfig>
===

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

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?

Larry

Reply via email to