锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲中文字幕视频国产,国产亚洲精品2021自在线,666精品国产精品亚洲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://22222xxx.com" target="_blank">国产成人精品日本亚洲11</a>| <a href="http://socgl.com" target="_blank">亚洲天堂福利视频</a>| <a href="http://xf002.com" target="_blank">日本特黄特色AAA大片免费</a>| <a href="http://cc006.com" target="_blank">香蕉视频在线观看免费国产婷婷</a>| <a href="http://xianfeng-motor.com" target="_blank">亚洲国产精品无码久久久</a>| <a href="http://zhaofeiz.com" target="_blank">99久久99热精品免费观看国产</a>| <a href="http://maomi02.com" target="_blank">婷婷亚洲久悠悠色悠在线播放</a>| <a href="http://240842.com" target="_blank">一级毛片在线免费观看</a>| <a href="http://wwwly6080.com" target="_blank">一区二区三区亚洲</a>| <a href="http://www-ttyx.com" target="_blank">无码免费一区二区三区免费播放</a>| <a href="http://chiyizi.com" target="_blank">久久夜色精品国产噜噜亚洲AV</a>| <a href="http://jhmydxx.com" target="_blank">2021在线永久免费视频</a>| <a href="http://jsjumei.com" target="_blank">亚洲AV一二三区成人影片</a>| <a href="http://3333kkkk.com" target="_blank">免费特级黄毛片在线成人观看 </a>| <a href="http://xseporn.com" target="_blank">久艹视频在线免费观看</a>| <a href="http://qqcnm.com" target="_blank">少妇中文字幕乱码亚洲影视</a>| <a href="http://sky233.com" target="_blank">日本免费网站视频www区</a>| <a href="http://f4f8.com" target="_blank">学生妹亚洲一区二区</a>| <a href="http://chinaedubrand.com" target="_blank">精品国产免费一区二区</a>| <a href="http://28896543.com" target="_blank">免费又黄又爽又猛大片午夜</a>| <a href="http://520baoyu.com" target="_blank">亚洲色欲色欲www在线丝</a>| <a href="http://qixiresort.com" target="_blank">一区二区三区无码视频免费福利</a>| <a href="http://1877808.com" target="_blank">久久久久亚洲AV无码麻豆</a>| <a href="http://8833655.com" target="_blank">青春禁区视频在线观看直播免费</a>| <a href="http://xyyfamily.com" target="_blank">亚洲日韩av无码中文</a>| <a href="http://www55xx.com" target="_blank">AV在线播放日韩亚洲欧</a>| <a href="http://changfafangzhi.com" target="_blank">久9这里精品免费视频</a>| <a href="http://79909d.com" target="_blank">中国亚洲呦女专区</a>| <a href="http://langya2255.com" target="_blank">亚洲成aⅴ人片久青草影院</a>| <a href="http://wwwst6.com" target="_blank">国产精品免费一区二区三区四区</a>| <a href="http://276194.com" target="_blank">亚洲视频在线观看网址</a>| <a href="http://helloyp.com" target="_blank">精品免费久久久久久成人影院</a>| <a href="http://930mk.com" target="_blank">久99久无码精品视频免费播放</a>| <a href="http://929119.com" target="_blank">久久久久亚洲av无码专区导航</a>| <a href="http://34007c.com" target="_blank">精品国产麻豆免费网站</a>| <a href="http://koukoub.com" target="_blank">免费黄色电影在线观看</a>| <a href="http://1314c.com" target="_blank">亚洲AV无码一区二区三区久久精品</a>| <a href="http://www91pao.com" target="_blank">国产成人精品日本亚洲专区</a>| <a href="http://lyjhjx.com" target="_blank">97视频免费在线</a>| <a href="http://qmoread.com" target="_blank">一级毛片免费在线播放</a>| <a href="http://55xxb.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>