Springboot mysql 基本CRUD操作【22】

 

 

配置连接数据库

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/scott?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=123456

package com.rich.springdatajpa.entity;

import javax.persistence.*;

@Entity
@Table(name="dept")
public class Dept {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="deptno")
    private Integer deptno;

    @Column(name="dname")
    private String dname;

    @Column(name="loc")
    private String location;

    public Integer getDeptno() {
        return deptno;
    }

    public void setDeptno(Integer deptno) {
        this.deptno = deptno;
    }

    public String getDname() {
        return dname;
    }

    public void setDname(String dname) {
        this.dname = dname;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }
}

 

发布了83 篇原创文章 · 获赞 2 · 访问量 6389

猜你喜欢

转载自blog.csdn.net/xfb1989/article/details/104062378