标签:driver get ted rate time getpass rac classname com
application.properties文件内容为:
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/demo?characterEncoding=utf-8&serverTimezone=GMT%2B8 spring.datasource.username=root spring.datasource.password=root spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true
自动建表实体对象为:
package com.ysoo.entity; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.io.Serializable; @Entity @Table(name = "t_user") public class User implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "uuid") @GenericGenerator(name = "uuid", strategy = "uuid2") @Column(name = "id") private String id; @Column(name = "name") private String name; @Column(name = "password") private String password; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
@GeneratedValue和@GenericGenerator注解需要如上配置 否则会出现建表不成功或者生成hibernate_sequence多余的表
标签:driver get ted rate time getpass rac classname com
原文地址:https://www.cnblogs.com/rain-in-summer/p/9956986.html