我认为这可能是这可能dupplicate:Schema-validation: missing table [hibernate_sequences],但我无法弄清楚。模式的验证:缺少表[游戏]
所以在我application.properties
文件我有这个选项:spring.jpa.hibernate.ddl-auto=validate
和我收到此错误:
Schema-validation: missing table [game]
为什么我收到这个?
这是我Game
类和User
类:
游戏:
@Entity
public class Game {
@Id
@Column(name = "GAME_NUMBER")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long gameNumber;
private int playerScore;
private int NPCScore;
private Date datetime;
@ManyToOne
@JoinColumn(name="USER_ID")
private User user;
public Game() {}
public Game(int playerScore, int nPCScore, Date datetime) {
super();
this.playerScore = playerScore;
this.NPCScore = nPCScore;
this.datetime = datetime;
}
public User getUser() {
return user;
}
} + getters & setters
用户:
@Entity
public class User {
@Id
@Column(name = "USER_ID")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long userId;
private String username;
private String password;
@OneToMany(mappedBy="user",cascade=CascadeType.ALL)
private List<Game> games;
@ElementCollection
private List<Date> startSessions;
public User() {}
public User(String username, String password, List<Game> games, List<Date> startSessions) {
super();
this.username = username;
this.password = password;
this.games = games;
this.startSessions = startSessions;
}
}
我解决了问题,并创建表[游戏],现在它工作正常。 – Rares
您可以检查这个问题PLZ? https://stackoverflow.com/q/44485076/7947794 – Rares