锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲一本之道高清乱码,久久久久亚洲精品男人的天堂,在线视频亚洲一区http://m.tkk7.com/keweibo/category/43121.html涓涓? Java 澶氳兘 Delphi,Powerbuilder ... zh-cnSat, 06 Aug 2011 06:18:24 GMTSat, 06 Aug 2011 06:18:24 GMT60mybatis3.05 鍒嗛〉鏀惰棌http://m.tkk7.com/keweibo/articles/355693.htmlKeKeWed, 03 Aug 2011 09:15:00 GMThttp://m.tkk7.com/keweibo/articles/355693.htmlhttp://m.tkk7.com/keweibo/comments/355693.htmlhttp://m.tkk7.com/keweibo/articles/355693.html#Feedback0http://m.tkk7.com/keweibo/comments/commentRss/355693.htmlhttp://m.tkk7.com/keweibo/services/trackbacks/355693.html浠ヤ笅鍏у渚嗚嚜:
http://zhaohe162.blog.163.com/blog/static/38216797201131262952990/

1.鎶奾ibernate涓嬬殑dialect鍖呭叏閮ㄦ嫹璐濆埌mybatis鍖呯殑jdbc鐩綍涓嬶紝濡備笅鍥炬墍紺猴細

mybatis涓嬬殑鍒嗛〉錛屾敮鎸佹墍鏈夌殑鏁版嵁搴?- 鏂皹浼ょ棔 - 鏂皹灞? style=
 



2.瀹氫箟涓涓猂esultSetHandler  Interceptor

package cn.machi.utils;

import java.sql.Statement;
import java.util.Properties;

import org.apache.ibatis.executor.resultset.FastResultSetHandler;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.session.RowBounds;

@Intercepts( {@Signature(type = ResultSetHandler.class, method = "handleResultSets", args = {Statement.class})})
public class DiclectResultSetHandlerInterceptor implements Interceptor
{
   
    public Object intercept(Invocation invocation) throws Throwable
    {
        FastResultSetHandler resultSet = (FastResultSetHandler)invocation.getTarget();
       
        RowBounds rowBounds = (RowBounds)ReflectUtil.getFieldValue(resultSet,
                "rowBounds");
       
        if (rowBounds.getLimit() > 0
                && rowBounds.getLimit() < RowBounds.NO_ROW_LIMIT)
        {
            ReflectUtil.setFieldValue(resultSet, "rowBounds", new RowBounds());
        }
        return invocation.proceed();
    }
   
    public Object plugin(Object target)
    {
        return Plugin.wrap(target, this);
    }
   
    public void setProperties(Properties properties)
    {
    }
}

 

3.瀹氫箟涓涓猄tatementHandler鐨処nterceptor

package cn.machi.utils;

import java.sql.Connection;
import java.util.Properties;

import org.apache.ibatis.executor.statement.PreparedStatementHandler;
import org.apache.ibatis.executor.statement.RoutingStatementHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.jdbc.dialect.OracleDialect;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.session.RowBounds;

@Intercepts( {@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class})})
public class DiclectStatementHandlerInterceptor implements Interceptor
{
   
    private static final String DIALECT = "org.apache.ibatis.jdbc.dialect.OracleDialect";
   
    public Object intercept(Invocation invocation) throws Throwable
    {
        RoutingStatementHandler statement = (RoutingStatementHandler)invocation.getTarget();
        PreparedStatementHandler handler = (PreparedStatementHandler)ReflectUtil.getFieldValue(statement,
                "delegate");
        RowBounds rowBounds = (RowBounds)ReflectUtil.getFieldValue(handler,
                "rowBounds");
       
        if (rowBounds.getLimit() > 0
                && rowBounds.getLimit() < RowBounds.NO_ROW_LIMIT)
        {
            BoundSql boundSql = statement.getBoundSql();
            String sql = boundSql.getSql();
           
            OracleDialect dialect = (OracleDialect)Class.forName(DIALECT)
                    .newInstance();
            sql = dialect.getLimitString(sql,
                    rowBounds.getOffset(),
                    rowBounds.getLimit());
           
            ReflectUtil.setFieldValue(boundSql, "sql", sql);
        }
        return invocation.proceed();
    }
   
    public Object plugin(Object target)
    {
        return Plugin.wrap(target, this);
    }
   
    public void setProperties(Properties properties)
    {
    }
}

4.瀹氫箟宸ュ叿綾籖eflectUtil

package cn.machi.utils;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

import org.apache.log4j.Logger;


public class ReflectUtil
{
    private static Logger log = Logger.getLogger(ReflectUtil.class);
   
    private static Object operate(Object obj, String fieldName,
            Object fieldVal, String type)
    {
        Object ret = null;
        try
        {
            // 鑾峰緱瀵硅薄綾誨瀷 
            Class<? extends Object> classType = obj.getClass();
            // 鑾峰緱瀵硅薄鐨勬墍鏈夊睘鎬?nbsp;
            Field fields[] = classType.getDeclaredFields();
            for (int i = 0; i < fields.length; i++)
            {
                Field field = fields[i];
                if (field.getName().equals(fieldName))
                {
                   
                    String firstLetter = fieldName.substring(0, 1)
                            .toUpperCase(); // 鑾峰緱鍜屽睘鎬у搴旂殑getXXX()鏂規硶鐨勫悕瀛?nbsp;
                    if ("set".equals(type))
                    {
                        String setMethodName = "set" + firstLetter
                                + fieldName.substring(1); // 鑾峰緱鍜屽睘鎬у搴旂殑getXXX()鏂規硶 
                        Method setMethod = classType.getMethod(setMethodName,
                                new Class[] {field.getType()}); // 璋冪敤鍘熷璞$殑getXXX()鏂規硶 
                        ret = setMethod.invoke(obj, new Object[] {fieldVal});
                    }
                    if ("get".equals(type))
                    {
                        String getMethodName = "get" + firstLetter
                                + fieldName.substring(1); // 鑾峰緱鍜屽睘鎬у搴旂殑setXXX()鏂規硶鐨勫悕瀛?nbsp;
                        Method getMethod = classType.getMethod(getMethodName,
                                new Class[] {});
                        ret = getMethod.invoke(obj, new Object[] {});
                    }
                    return ret;
                }
            }
        }
        catch (Exception e)
        {
            log.warn("reflect error:" + fieldName, e);
        }
        return ret;
    }
   
    public static Object getVal(Object obj, String fieldName)
    {
        return operate(obj, fieldName, null, "get");
    }
   
    public static void setVal(Object obj, String fieldName, Object fieldVal)
    {
        operate(obj, fieldName, fieldVal, "set");
    }
   
   
    private static Method getDeclaredMethod(Object object, String methodName,
            Class<?>[] parameterTypes)
    {
        for (Class<?> superClass = object.getClass(); superClass != Object.class; superClass = superClass.getSuperclass())
        {
            try
            {
                //superClass.getMethod(methodName, parameterTypes);
                return superClass.getDeclaredMethod(methodName, parameterTypes);
            }
            catch (NoSuchMethodException e)
            {
                //Method 涓嶅湪褰撳墠綾誨畾涔? 緇х畫鍚戜笂杞瀷
            }
        }
       
        return null;
    }
   
   
    private static void makeAccessible(Field field)
    {
        if (!Modifier.isPublic(field.getModifiers()))
        {
            field.setAccessible(true);
        }
    }
   
   
    private static Field getDeclaredField(Object object, String filedName)
    {
        for (Class<?> superClass = object.getClass(); superClass != Object.class; superClass = superClass.getSuperclass())
        {
            try
            {
                return superClass.getDeclaredField(filedName);
            }
            catch (NoSuchFieldException e)
            {
                //Field 涓嶅湪褰撳墠綾誨畾涔? 緇х畫鍚戜笂杞瀷
            }
        }
        return null;
    }
   
   
    public static Object invokeMethod(Object object, String methodName,
            Class<?>[] parameterTypes, Object[] parameters)
            throws InvocationTargetException
    {
        Method method = getDeclaredMethod(object, methodName, parameterTypes);
       
        if (method == null)
        {
            throw new IllegalArgumentException("Could not find method ["
                    + methodName + "] on target [" + object + "]");
        }
       
        method.setAccessible(true);
       
        try
        {
            return method.invoke(object, parameters);
        }
        catch (IllegalAccessException e)
        {
           
        }
       
        return null;
    }
   
   
    public static void setFieldValue(Object object, String fieldName,
            Object value)
    {
        Field field = getDeclaredField(object, fieldName);
       
        if (field == null)
            throw new IllegalArgumentException("Could not find field ["
                    + fieldName + "] on target [" + object + "]");
       
        makeAccessible(field);
       
        try
        {
            field.set(object, value);
        }
        catch (IllegalAccessException e)
        {
            e.printStackTrace();
        }
    }
   
   
    public static Object getFieldValue(Object object, String fieldName)
    {
        Field field = getDeclaredField(object, fieldName);
        if (field == null)
            throw new IllegalArgumentException("Could not find field ["
                    + fieldName + "] on target [" + object + "]");
       
        makeAccessible(field);
       
        Object result = null;
        try
        {
            result = field.get(object);
        }
        catch (IllegalAccessException e)
        {
            e.printStackTrace();
        }
       
        return result;
    }
   
}

5.鏇存柊mapper configuration鏂囦歡錛屾坊鍔犲涓嬪嚑鏉★紝娉ㄦ剰plugins鍦ㄦ暣涓猚onfiguration鏂囦歡涓殑欏哄簭

<plugins>
<plugin interceptor="functionPoint.db.DiclectStatementHandlerInterceptor"/>
<plugin interceptor="functionPoint.db.DiclectResultSetHandlerInterceptor"/>
</plugins>

6.浣跨敤鏂規硶鍚宮ybatis閫昏緫鍒嗛〉錛屾嫤鎴櫒浼氳嚜鍔ㄦ嫤鎴墽琛孲QL鐨勫湴鏂癸紝鍔犱笂鍒嗛〉浠g爜錛?/strong>

getSqlSession().selectList(mapId, queryKey,new RowBounds(pageId, pageSize));


==============================================================
鎸夌収涓婇潰鐨勫仛浜?浣嗛亱琛屾檪鍗繪媼鍑虹己灝?IN OUT鍙冩暩涔嬮鐨勯尟瑾?
寰屼締鎻涗簡Dialect欏炴枃浠跺氨OK浜?OracleDialect鍏у鍙冭冭嚜:
http://rapid-framework.googlecode.com/svn/trunk/rapid-framework/src/rapid_framework_common/cn/org/rapid_framework/jdbc/dialect/




Ke 2011-08-03 17:15 鍙戣〃璇勮
]]>
瀛樺偍榪囩▼http://m.tkk7.com/keweibo/articles/306057.htmlKeKeTue, 15 Dec 2009 11:39:00 GMThttp://m.tkk7.com/keweibo/articles/306057.htmlhttp://m.tkk7.com/keweibo/comments/306057.htmlhttp://m.tkk7.com/keweibo/articles/306057.html#Feedback0http://m.tkk7.com/keweibo/comments/commentRss/306057.htmlhttp://m.tkk7.com/keweibo/services/trackbacks/306057.html <parameterMap id="swapParameters" class="map" >
<parameter property="email1" jdbcType="VARCHAR" javaType="java.lang.String" mode="INOUT"/>
<parameter property="email2" jdbcType="VARCHAR" javaType="java.lang.String" mode="INOUT"/>
</parameterMap>
<procedure id="swapEmailAddresses" parameterMap="swapParameters" >
{call swap_email_address (?, ?)}
</procedure>

Ke 2009-12-15 19:39 鍙戣〃璇勮
]]>
鑷姩鐢熸垚鐨勪富閿?/title><link>http://m.tkk7.com/keweibo/articles/306055.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Tue, 15 Dec 2009 11:37:00 GMT</pubDate><guid>http://m.tkk7.com/keweibo/articles/306055.html</guid><wfw:comment>http://m.tkk7.com/keweibo/comments/306055.html</wfw:comment><comments>http://m.tkk7.com/keweibo/articles/306055.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/keweibo/comments/commentRss/306055.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/keweibo/services/trackbacks/306055.html</trackback:ping><description><![CDATA[寰堝鏁版嵁搴撴敮鎸佽嚜鍔ㄧ敓鎴愪富閿殑鏁版嵁綾誨瀷銆備笉榪囪繖閫氬父錛堝茍涓嶆繪槸錛夋槸涓鏈夌殑鐗規с係QL Map閫氳繃<insert>鐨勫瓙鍏冪礌<selectKey>鏉ユ敮鎸佽嚜鍔ㄧ敓鎴愮殑閿箋傚畠鍚屾椂鏀寔棰勭敓鎴愶紙濡侽racle錛夊拰鍚庣敓鎴愪袱縐嶇被鍨嬶紙濡侻S-SQL Server錛夈備笅闈㈡槸涓や釜渚嬪瓙錛?br /> <<br /> !鈥擮racle SEQUENCE Example --><br /> <insert id="insertProduct-ORACLE" parameterClass="com.domain.Product"><br /> <selectKey resultClass="int" keyProperty="id" ><br /> SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL<br /> </selectKey><br /> insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)<br /> values (#id#,#description#)<br /> </insert><br /> <!鈥?Microsoft SQL Server IDENTITY Column Example --><br /> <insert id="insertProduct-MS-SQL" parameterClass="com.domain.Product"><br /> insert into PRODUCT (PRD_DESCRIPTION)<br /> values (#description#)<br /> <selectKey resultClass="int" keyProperty="id" ><br /> SELECT @@IDENTITY AS ID<br /> </selectKey><br /> </insert> <img src ="http://m.tkk7.com/keweibo/aggbug/306055.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/keweibo/" target="_blank">Ke</a> 2009-12-15 19:37 <a href="http://m.tkk7.com/keweibo/articles/306055.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://m.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://tjtangpu.com" target="_blank">成人在线免费视频</a>| <a href="http://www55xx.com" target="_blank">亚洲一区二区免费视频</a>| <a href="http://53ggk.com" target="_blank">国产免费人成视频尤勿视频 </a>| <a href="http://deyingwh.com" target="_blank">亚洲黄色片免费看</a>| <a href="http://hjndgb.com" target="_blank">亚洲日韩图片专区第1页</a>| <a href="http://15831883389.com" target="_blank">国产午夜精品久久久久免费视 </a>| <a href="http://ddxsrd.com" target="_blank">18以下岁毛片在免费播放</a>| <a href="http://www789789.com" target="_blank">亚洲成人激情在线</a>| <a href="http://hsewx.com" target="_blank">国产精品亚洲视频</a>| <a href="http://wwwks2424.com" target="_blank">亚洲二区在线视频</a>| <a href="http://tzntrip.com" target="_blank">久久精品无码一区二区三区免费</a>| <a href="http://snsdtv.com" target="_blank">亚洲国产美女在线观看 </a>| <a href="http://sds54.com" target="_blank">1a级毛片免费观看</a>| <a href="http://www-7607.com" target="_blank">亚洲日本在线播放</a>| <a href="http://yes5555.com" target="_blank">免费高清小黄站在线观看</a>| <a href="http://by6174.com" target="_blank">狠狠入ady亚洲精品</a>| <a href="http://5ggy.com" target="_blank">亚洲精品无码久久久</a>| <a href="http://amgzh.com" target="_blank">在线看片免费人成视频福利</a>| <a href="http://mmm19.com" target="_blank">色噜噜综合亚洲av中文无码</a>| <a href="http://ghiearning.com" target="_blank">亚洲性线免费观看视频成熟</a>| <a href="http://jgxsdst.com" target="_blank">亚洲一区二区三区国产精华液</a>| <a href="http://qingdaostf.com" target="_blank">中文字幕无码免费久久</a>| <a href="http://33338x.com" target="_blank">久久亚洲AV成人无码</a>| <a href="http://zhaosaohuo.com" target="_blank">毛片a级毛片免费播放下载</a>| <a href="http://dajiaody.com" target="_blank">猫咪免费人成在线网站</a>| <a href="http://ninidian.com" target="_blank">亚洲精品无码乱码成人</a>| <a href="http://448tk.com" target="_blank">一级做a免费视频观看网站</a>| <a href="http://baocaoluoli.com" target="_blank">亚洲av永久无码精品秋霞电影影院</a>| <a href="http://www-75044.com" target="_blank">无码国产精品一区二区免费3p</a>| <a href="http://jastrelax.com" target="_blank">国产精品亚洲综合五月天</a>| <a href="http://tlyyt.com" target="_blank">免费国产在线观看</a>| <a href="http://www4jbd.com" target="_blank">久久国产免费一区二区三区</a>| <a href="http://da666f.com" target="_blank">一本色道久久88—综合亚洲精品</a>| <a href="http://xyxpx.com" target="_blank">亚洲AV永久无码精品一区二区国产 </a>| <a href="http://wankufan.com" target="_blank">亚洲va中文字幕无码久久 </a>| <a href="http://625r.com" target="_blank">亚洲免费在线视频播放</a>| <a href="http://by2988.com" target="_blank">亚洲高清毛片一区二区</a>| <a href="http://mm1131.com" target="_blank">亚洲成AV人片在</a>| <a href="http://wushicn.com" target="_blank">日韩电影免费在线</a>| <a href="http://52xbjs.com" target="_blank">无码少妇精品一区二区免费动态</a>| <a href="http://xiaomaomi8.com" target="_blank">亚洲一区二区三区在线观看网站</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>