java 创建gbase_GBase8s + MyBatis 操作示例

GBase8s Spring Boot MyBatis 操作示例

本文将创建一个简单的 Spring Boot 项目结构,并演示如何使用 Mybatis 进行GBase 8s 数据库的数据

处理工作(插入,选择,更新和删除),以及分页显示。

MyBatis + XML方式

本文我们会使用 mybatis-spring-boot-starter 自动化配置 MyBatis 主要配置。同时,在 XML 中编写相

应的 SQL 操作。

1.1 引入依赖

在 pom.xml 文件中,引入相关依赖。

4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.5.RELEASE GBase8s-Spring-Boot-MyBatis-Demo GBase8s-Spring-Boot-MyBatis-Demo GBase8s-Spring-Boot-MyBatis-Demo 1.8 org.springframework.boot spring-boot-starter-jdbc com.gbasedbt gbasedbtjdbc 1.0.0 system ${project.basedir}/lib/ifxjdbc.jar org.mybatis.spring.boot 1234567891011121314151617181920212223242526272829303132333435363738

1.2 Application

创建 Application.java 类,配置 @MapperScan 注解,扫描对应 Mapper 接口所在的包路径。代码如

下:

cn.gbase.8s.demo.mybatis.mapper 包路径下,就是我们 Mapper 接口所在的包路径。

1.3 应用配置文件

在 resources 目录下,创建 application.yml 配置文件。配置如下:

mybatis-spring-boot-starter 2.1.1 org.springframework.boot spring-boot-starter-test test org.junit.vintage junit-vintage-engine org.springframework.boot spring-boot-maven-plugin true 394041424344454647484950515253545

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值