猿问

jpa无法自动创建数据库表

下面是配置信息:

spring.jpa:
    show-sql: true
    database: MYSQL
    properties.hibernate.dialect: org.hibernate.dialect.MySQL5Dialect
    hibernate:
      ddl-auto: update
      naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy

spring.datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.1.115/ssm?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true&serverTimezone=CTT
    username: admin
    password: 123456
    initial-size: 10
    max-wait: 10000
    maximum-pool-size: 100
    max-active: 100
    max-idle: 10
    minIdle: 2
    test-on-borrow: false
    test-on-return: true
    test-while-idle: true
    validation-query: select 1

下面是实体类:

@Entity
@Table(name = "ssm_icon")
public class Icon {
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;
    /**
     * 图标名称
     */
    @Column(name = "icon_name")
    private String iconName;
    /**
     * 图标地址
     */
    @Column(name = "icon_address")
    private String iconAddress;
    /**
     * 图标编码
     */
    @Column(name = "icon_code")
    private String iconCode;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getIconName() {
        return iconName;
    }

    public void setIconName(String iconName) {
        this.iconName = iconName;
    }

    public String getIconAddress() {
        return iconAddress;
    }

    public void setIconAddress(String iconAddress) {
        this.iconAddress = iconAddress;
    }

    public String getIconCode() {
        return iconCode;
    }

    public void setIconCode(String iconCode) {
        this.iconCode = iconCode;
    }
}

今天新建的一个srping boot项目无法jpa无法自动生成数据库表,把ddl-auto 换成create也不行,哪位大神可以帮忙看看是什么原因吗

胡子哥哥
浏览 826回答 1
1回答
随时随地看视频慕课网APP

相关分类

Java
我要回答