问题是这样的,当我每次添加新的实体类的时候,不管是不是放在已经存在的包中,在tomcat启动的时候
总是会报错(好像是一直在校验sql),有时候我弄一下莫名其妙的就好了,想知道为什么会这样.以下是配置以及问题:
2015-07-10 09:40:58.007 [localhost-startStop-1] DEBUG c.h.h.a.c.i.OffsetLimitInterceptor-OffsetLimitInterceptor.dialect=com.hongguaninfo.hgdf.core.utils.jdbc.dialect.MySQLDialect(这条信息会一直刷新,起码要四五分钟才能过去)
.MySQLDialect的内容:
public class MySQLDialect extends Dialect {
public boolean supportsLimitOffset() { return true; }
public boolean supportsLimit() { return true; }
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder) { if (offset > 0) { return sql + " limit " + offsetPlaceholder + "," + limitPlaceholder; } else { return sql + " limit " + limitPlaceholder; } }
}
mybatis配置:
<!-- myBatis配置SqlSessionFactoryBean --> <bean id="mySqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:/mybatis/mybatis-config.xml" />
<!-- typeAliasesPackage 多值可逗号分隔 -->
<property name="typeAliasesPackage"
value="com.hongguaninfo.hgdf.adp.entity,com.hongguaninfo.hgdf.adp.entity.sys,com.hongguaninfo.hgdf.adp.entity.feature,com.hongguaninfo.hgdf.adp.entity.other,com.hongguaninfo.hgdf.adp.entity.product" />
<property name="mapperLocations">
<list>
<value>classpath*:/mybatis/**/*-sqlmap.xml</value>
</list>
</property>
</bean>
<!-- 通过扫描的模式,扫描mapper目录下,所有的mapper都继承SqlMapper接口的接口 -->
<!-- 可使用逗号或分号建立多个basePackage -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- basePackage 多值可分号分隔 -->
<property name="basePackage"
value="com.hongguaninfo.hgdf.adp.mapper,com.hongguaninfo.hgdf.adp.mapper.sys,com.hongguaninfo.hgdf.adp.mapper.feature,com.hongguaninfo.hgdf.adp.entity.other,com.hongguaninfo.hgdf.adp.mapper.product" />
<property name="markerInterface" value="com.hongguaninfo.hgdf.adp.core.base.BaseSqlMapper" />
<property name="sqlSessionFactoryBeanName" value="mySqlSessionFactory" />
</bean>
mapper的位置:
<mapper namespace="com.hongguaninfo.hgdf.adp.mapper.product.TbCatalogNodeMapper">
实体类的位置:
com.hongguaninfo.hgdf.adp.entity.product;
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。