小编Seb*_*abó的帖子

Spring Boot应用程序Heroku PostgreSQL错误:GenerationTarget在接受命令时遇到异常:通过JDBC语句执行DDL时出错...

我使用 Spring Boot 创建了一个小型社交媒体应用程序,在开发过程中我使用了 H2 本地数据库,它运行得很好。现在我尝试将其连接到 Heroku PostgreSQL 数据库,但出现标题中的错误。有什么想法吗?我怀疑方言错误,但我检查的所有地方都应该像现在一样使用 org.hibernate.dialect.PostgreSQLDialect。否则,实体或映射可能会出现一些问题?即使是,我只是不知道修改什么以及如何修改它们。我对数据库很陌生,所以如果这是一些愚蠢的错误,请不要评判我。

实体类:用户

package com.schabby.socialplatform.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;

@Entity
@SequenceGenerator(name="seq", initialValue=1, allocationSize=100)
public class User implements Serializable {
    
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY, generator="seq")
    private Long id;
    
    private String username;
    private String password;
    private String name;
    private int age;
    private String picture;
    private boolean online;
    
    @JsonIgnore
    @OneToMany(mappedBy = "User")
    private Collection<Post> posts = new ArrayList<Post>();

    public User() { …
Run Code Online (Sandbox Code Playgroud)

java postgresql hibernate heroku spring-boot

5
推荐指数
1
解决办法
3624
查看次数

标签 统计

heroku ×1

hibernate ×1

java ×1

postgresql ×1

spring-boot ×1