mybatis支持属性使用驼峰的命名
mapUnderscoreToCamelCase:是否启用下划线与驼峰式命名规则的映射(如first_name => firstName)
开启:
mybatis-config.xml
<!-- 开启驼峰命名转换 seckill_id====>seckillId -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
在spring-dao.xml中进行配置
<!-- mybatis- sessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 注入数据库连接池 -->
<property name="dataSource" ref="dataSource"/>
<!-- 配置mybatis全局配置文件 -->
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<!-- 扫描entity包 使用别名
org.seckill.entity.Seckill===>Seckill resultType,parameterType
-->
<property name="typeAliasesPackage" value="org.seckill.entity"/>
<!-- 扫描sql配置文件 ,mapper.xml -->
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
</bean>