IT_tingge
低调的廷哥
采纳率14.3%
2016-05-21 02:51 阅读 1.8k

mybatis中sql问题求解决

在mysql客户端中执行下面语句

 select 
            sk.seckill_id,
            sk.user_phone,
            sk.create_time,
            sk.state,
            s.seckill_id "seckill.seckill_id",
            s.name "seckill.name",
            s.number "seckill.number",
            s.start_time "seckill.start_time",
            s.end_time "seckill.end_time",
            s.create_time "seckill.create_time"
        from success_killed sk
        inner join seckill s on sk.seckill_id = s.seckill_id
where sk.seckill_id=1 and sk.user_phone=13573615842

没有报错,但是配置在mybatis的xml中会出现下面的错误
信息: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
五月 21, 2016 10:50:17 上午 org.springframework.jdbc.support.SQLErrorCodesFactory
信息: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]
五月 21, 2016 10:50:17 上午 org.springframework.context.support.GenericApplicationContext doClose
信息: Closing org.springframework.context.support.GenericApplicationContext@4351aa16: startup date [Sat May 21 10:50:16 CST 2016]; root of context hierarchy

求解释

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • yu954663801 yu954663801 2016-05-21 06:22

    Spring容器配置有錯,發出來看看

    点赞 评论 复制链接分享
  • IT_tingge 低调的廷哥 2016-05-21 11:35
     <?xml version="1.0" encoding="UTF-8"?>  
    <beans xmlns="http://www.springframework.org/schema/beans"      
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      
           xmlns:p="http://www.springframework.org/schema/p"      
           xmlns:mvc="http://www.springframework.org/schema/mvc"      
           xmlns:context="http://www.springframework.org/schema/context"      
           xmlns:util="http://www.springframework.org/schema/util"      
           xsi:schemaLocation="http://www.springframework.org/schema/beans   
                http://www.springframework.org/schema/beans/spring-beans-4.1.xsd      
                http://www.springframework.org/schema/context   
                http://www.springframework.org/schema/context/spring-context-4.1.xsd      
                http://www.springframework.org/schema/mvc   
                http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd      
                http://www.springframework.org/schema/util   
                http://www.springframework.org/schema/util/spring-util-4.1.xsd">  
        <!-- 配置整合mybatis过程 -->
        <!-- 1:配置数据库相关参数 -->
        <context:property-placeholder location="classpath:jdbc.properties"/>
        <!-- 配置数据库连接池 -->
        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
            <!-- 配置连接池属性 
            不要用username,因为会冲突
            -->
            <property name="driverClass" value="${driver}"/>
            <property name="jdbcUrl" value="${url}"/>
            <property name="user" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <!-- c3p0连接池的私有属性 -->
            <property name="maxPoolSize" value="30"/>
            <property name="minPoolSize" value="10"/>
            <!-- 关闭连接后不自动commit -->
            <property name="autoCommitOnClose" value="false"/>
            <!-- 获取连接超时时间 -->
            <property name="checkoutTimeout" value="1000"/>
            <!-- 当获取连接失败重试次数 -->
            <property name="acquireRetryAttempts" value="2"/>
        </bean>
    
        <!-- 配置SqlSessionFactoty对象 -->
        <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
            <!-- 注入数据库连接池 -->
            <property name="dataSource" ref="dataSource"/>
            <!-- 配置MyBatis全局配置文件:mybatis-config.xml -->
            <property name="configLocation" value="classpath:mybatis-config.xml"/>
            <!-- 扫描entity包,使用别名 -->
            <property name="typeAliasesPackage" value="cn.icodelife.entity"/>
            <!-- 扫描sql配置文件:mapper需要的xml文件 -->
            <property name="mapperLocations" value="classpath:mapper/*.xml"/>
        </bean>
    
    
        <!-- 配置扫描dao接口包 -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <!-- 注入sqlSessionFactory -->
            <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
            <!-- 给出扫描dao接口的包 -->
            <property name="basePackage" value="cn.icodelife.dao"/>
        </bean>
    </beans>
    
    
    点赞 评论 复制链接分享
  • qq_30408111 二三三 2016-05-21 12:20

    数据库里添加的数据库类型不一样,看看那个属性的数据类型不一致

    点赞 评论 复制链接分享

相关推荐