com.jdon.model.query
Class JdbcTemp

java.lang.Object
  extended by com.jdon.model.query.JdbcTemp

public class JdbcTemp
extends java.lang.Object

JDBC Template using this class, don't need write jdbc operations.


Constructor Summary
JdbcTemp(javax.sql.DataSource dataSource)
           
 
Method Summary
 void operate(java.util.Collection insertParams, java.lang.String sql)
          this method can used for insert/update/delete for database In insertParams the parameter type only supports: String Integer Float or Long Double Bye Short if you need operate other types, you must use JDBC directly replacing this method.
 java.util.List queryMultiObject(java.util.Collection queryParams, java.lang.String sqlquery)
          this method is fit for this sql: select id, name, password from user where id = ? the " id, name, password " and its values are packed in a map of returen list.
 java.util.List queryMultiObject(java.util.Collection queryParams, java.lang.String sqlquery, int start, int count)
          same as queryMultiObject(Collection queryParams, String sqlquery) but the result is a block result, the result'size is the value of count, and the result's start poiny is the value of start.
 java.lang.Object querySingleObject(java.util.Collection queryParams, java.lang.String sqlquery)
          get a single object from database fit for this sql: select name from user where id=? the "name" is single result
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcTemp

public JdbcTemp(javax.sql.DataSource dataSource)
Method Detail

querySingleObject

public java.lang.Object querySingleObject(java.util.Collection queryParams,
                                          java.lang.String sqlquery)
                                   throws java.lang.Exception
get a single object from database fit for this sql: select name from user where id=? the "name" is single result

Parameters:
queryParams -
sqlquery -
Returns:
Throws:
java.lang.Exception

queryMultiObject

public java.util.List queryMultiObject(java.util.Collection queryParams,
                                       java.lang.String sqlquery)
                                throws java.lang.Exception
this method is fit for this sql: select id, name, password from user where id = ? the " id, name, password " and its values are packed in a map of returen list.

Parameters:
queryParams -
sqlquery -
Returns:
Throws:
java.lang.Exception

queryMultiObject

public java.util.List queryMultiObject(java.util.Collection queryParams,
                                       java.lang.String sqlquery,
                                       int start,
                                       int count)
                                throws java.lang.Exception
same as queryMultiObject(Collection queryParams, String sqlquery) but the result is a block result, the result'size is the value of count, and the result's start poiny is the value of start.

Parameters:
queryParams -
sqlquery -
start -
count -
Returns:
Throws:
java.lang.Exception

operate

public void operate(java.util.Collection insertParams,
                    java.lang.String sql)
             throws java.lang.Exception
this method can used for insert/update/delete for database In insertParams the parameter type only supports: String Integer Float or Long Double Bye Short if you need operate other types, you must use JDBC directly replacing this method.

Parameters:
insertParams - the parameter that will be insert into sql.
sql - the standard sql sentence.
Throws:
java.lang.Exception