列user0_.id不存在

时间:2019-03-06 11:49:01

标签: spring postgresql

项目崩溃的原因很简单-它看不到表格(在我看来),也许问题出在@Table注释中

@Entity
@Table(name = "user")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class User extends BaseEntity<Long> {
public enum Roles {
    ADMIN
}
private String firstName;
private String lastName;
@Column(name = "username")
private String username;
@Convert(converter = PurshasedProductConverter.class)
private List<PurshasedProduct> purshasedProducts;


private String email;
private String activationCode;

@Convert(converter = AttachmentConverter.class)
private Attachment userAvatar;
public Attachment getUserAvatar() {
    return userAvatar;
}

public void setUserAvatar(Attachment userAvatar) {
    this.userAvatar = userAvatar;
}


@JsonProperty(access = Access.WRITE_ONLY)
private String password;
@JsonProperty(access = Access.WRITE_ONLY)
private String temporaryPassword;

@Convert(converter = StringArrayConverter.class)
private String[] roles;

private Date lastPasswordReset;

private Date dateCreated;
private Date dateUpdated;
private Date validatyTime;
private Boolean active;}

我曾经有@Table (name = "\" user \ ""),但是现在您在代码中看到了,这给我带来了许多其他问题,但是它不起作用。这是错误本身Caused by: org.postgresql.util.PSQLException: ERROR: column user0_.id does not exist

有人建议将模式添加到表注释中,但这对我没有帮助

1 个答案:

答案 0 :(得分:0)

我也遇到了这个问题,在我的@Table 注释中包含模式名称解决了这个问题:

@Table(name = "user", schema="mySchema")