mybatis+tk mapper使用oracle sequence自增时其中一点小结

tk mapper配置略过,直接记了:

@Table(name = "table")
public class TableEntity {

    /*@SequenceGenerator(name="Any",sequenceName="sequence")*/
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "select sequence.nextval from dual")
    @Id
    private Integer id;
}

注意1:properties中的配置属性一定要注意别漏了


    
        
        
        
            
                mappers=tk.mybatis.mapper.common.Mapper
                ORDER=BEFORE
            
        

    

注意2:对应的configLocation属性中的配置文件 中  useGeneratedKeys 需要设置为false 不然会再次生成自增,oracle数据报错,其他库没有测试过抱歉。



你可能感兴趣的:(mybatis+tk mapper使用oracle sequence自增时其中一点小结)