tk Mapper Oracle数据库和Mysql数据库插入时返回主键
主键生成策略
Oracle
@Id @GeneratedValue(strategy = GenerationType.IDENTITY, generator="SELECT F_DEMO_SEQ.NEXTVAL FROM DUAL") private Long id;
Mysql
@Id @GeneratedValue(generator="JDBC") private Long id;
MapperScannerConfigurer
<bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.wjz.mapper"/> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> <property name="properties"> <value> mappers=tk.mybatis.mapper.common.Mapper ORDER=BEFORE </value> </property> </bean>