MyBatis-Spring-Boot icon indicating copy to clipboard operation
MyBatis-Spring-Boot copied to clipboard

Spring Boot集成MyBatis的基础项目

Results 96 MyBatis-Spring-Boot issues
Sort by recently updated
recently updated
newest added

如题。当用在一些设计不完美的数据库上时,会有sql关键字冲突,如果加上 ` 包裹字段,就可以解决此问题。

@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "select REPLACE(uuid(),'-','')") 在springboot 中要使用这个的话需要做怎样的配置呢

2017-06-19 14:51:20.754 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.MapperAutoConfiguration': Invocation of init method failed; nested exception is tk.mybatis.mapper.MapperException: tk.mybatis.mapper.provider.EmptyProvider中缺少selectOne方法! at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409)...

INSERT INTO t_sys_user(id,create_time,account,name,memo,phone,email,sort,state) VALUES ( #{id}这个Id是自动生成的32uuid,这个有好的方法么,#{user.createTime},#{user.account},#{user.name},#{user.memo},#{user.phone},#{user.email},#{user.sort},#{user.state})

@abel533,前辈您好! --- 使用您的分页插件时出现了问题.以下是出现的问题和自己的配置以及代码 报错信息 ![image](https://user-images.githubusercontent.com/23494400/33317299-a365fb12-d471-11e7-8649-afa31a48de9f.png) Spring boot的application.properties ![image](https://user-images.githubusercontent.com/23494400/33317390-ef8f455c-d471-11e7-82fd-bda55f4e8219.png) 改成Javaconfig的方式配置Pagehelper可以注册这个Pagehelper但是调用时依然会报空指针异常,请大神看下是什么原因 代码块: ![image](https://user-images.githubusercontent.com/23494400/33317586-8503232e-d472-11e7-9b3a-994319933c8b.png) --- 2017-11-29 00:10:33 更新 采用spring配置SqlSessionFactoryBean获取sessionfactory依然可以,但是仍然报以上的错. pagehelper拦截器 ![image](https://user-images.githubusercontent.com/23494400/33330250-5426e7dc-d499-11e7-81e3-b704908727b7.png) sessionfactory ![image](https://user-images.githubusercontent.com/23494400/33330437-d3116644-d499-11e7-8a7d-2cbe13dc758f.png) Springboot启动类 ![image](https://user-images.githubusercontent.com/23494400/33330583-2cc075cc-d49a-11e7-8936-7a7519260f25.png) resources下和mybatis相关的只有MBG了 ![image](https://user-images.githubusercontent.com/23494400/33330689-7f85db3a-d49a-11e7-8160-1d9c138a4c00.png) 折腾了一晚上实在不知道到底哪里出了问题了,前辈求指导,谢谢您~.~

1.2.3 1.1.5 ![image](https://user-images.githubusercontent.com/13740807/33065267-51ddfd00-cee3-11e7-9e9b-cf3951075788.png) 生成的sql不对~不知道还需要设置那里? SELECT id,create_time,status,system_order_id,actual_payment_amount,sub_order_number,sub_order_status,payment_amount,product_count,payment_method,buyer_user_id,seller_user_id,shop_title,seller_appkey,buyer_appkey,delivery_method,delivery_method_money,apply_account,invoice,invoice_type,invoice_title_type,personal_name,enterprise_name,enterprise_ein,invoice_content,buyer_message,payment_day,payment_money,payment_status,logistics_number FROM system_sub_order WHERE ( buyer_user_id = ? and sub_order_status = ? ) order by id desc LIMIT ? 56(Integer), 05(String), 10(Integer)

public PageInfo getAll( City city ) { List countryList = cityService.getAll( city ); return new PageInfo( countryList ); } 比如我想每页显示5条, 在查出list以后, 返回之前设置怎么搞?

遇到了奇怪的报错: Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class at tk.mybatis.mapper.mapperhelper.MapperHelper.setSqlSource(MapperHelper.java:247) at tk.mybatis.mapper.mapperhelper.MapperHelper.processConfiguration(MapperHelper.java:310) at tk.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:54) at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 52 more Caused by: java.lang.RuntimeException:...