【发布时间】:2019-12-14 13:54:17
【问题描述】:
尽管关于这个主题已经有很多问题,但到目前为止,没有一个答案对我有帮助。 我的application.properties的代码:
spring.h2.console.enabled=true
spring.datasource.platform=h2
spring.datasource.url=jdbc:h2:mem:testdb
我的实体的一个例子:
import java.util.Date;
import javax.persistence.*;
import org.springframework.boot.autoconfigure.*;
@Entity
@EnableAutoConfiguration
public class Customer {
@Id
private int customerId;
private String name;
private String street;
private String zip;
private String city;
private Date differenceSince;
private Date lastUpdatedOn;
@OneToOne
private User lastUpdatedBy;
//getters and setters ...
}
依赖关系:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
关于我缺少什么的任何想法?
【问题讨论】:
标签: java spring-boot h2