在项目开发过程中,查询数据的时候难免会出现一些问题。
数据库的连接,配置等等都没有问题,但是就是取不到数据。
mapper
@Mapper
public interface PassportMapper {
@Results(id = "PassportTypeMapper" ,
value = {@Result(column = "type_id", property = "typeID", id = true),
@Result(column = "type_name", property = "typeName")})
@Select("select * from passport_types")
public List<PassportType> listAll();
}
数据库的配置
server.port=8888
spring.datasource.url=jdbc:mariadb://localhost:3306/bbtbunisess
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
logging.level.com.wangrui.bbtbisness.daomapper=debug
但是就是取不到数据,数据里的存了数据,查不到数据
查了一圈发现是数据没有commit,commit之后就查到了