Spring 正在获取一系列SQL警告:“0”;关系<;表>;不存在,跳过“;
我不知道这是否值得担心,但随着服务器启动,我收到了一系列警告:Spring 正在获取一系列SQL警告:“0”;关系<;表>;不存在,跳过“;,spring,postgresql,hibernate,spring-boot,Spring,Postgresql,Hibernate,Spring Boot,我不知道这是否值得担心,但随着服务器启动,我收到了一系列警告: o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 0, SQLState: 00000 o.h.engine.jdbc.spi.SqlExceptionHelper : relation "app_user__user_group" does not exist, skipping o.h.engine.jdbc.spi.SqlExceptionHelper
o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 0, SQLState: 00000
o.h.engine.jdbc.spi.SqlExceptionHelper : relation "app_user__user_group" does not exist, skipping
o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 0, SQLState: 00000
o.h.engine.jdbc.spi.SqlExceptionHelper : relation "app_user__user_group" does not exist, skipping
o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 0, SQLState: 00000
o.h.engine.jdbc.spi.SqlExceptionHelper : relation "google_place" does not exist, skipping
o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 0, SQLState: 00000
...
我不能说这导致了一个问题-到目前为止一切都正常-但我想了解这里发生了什么
这是我正在使用的配置:
spring.jpa.properties.hibernate.temp.use\u jdbc\u metadata\u defaults=false
#由于检测被禁用,您必须手动设置正确的方言。
spring.jpa.database platform=org.hibernate.dial.postgresql95dial
spring.datasource.url=jdbc:postgresql://localhost/test-db
spring.datasource.username=postgres
spring.datasource.password=root
spring.datasource.driver类名=org.postgresql.driver
#spring.jpa.properties.hibernate.dialogue=org.hibernate.dialogue.postgresql95dialogue
#spring.jpa.show sql=false
spring.jpa.hibernate.ddl auto=createdrop
#更新
#创建下降
这里,作为一个例子,是
google\u place
的@实体
:
@Entity
@Table(name = "google_place")
public class GooglePlace extends AbstractTimestampEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToOne
@JoinColumn(name = "place_id")
private Place place;
@Column(name = "google_place_id", unique = true)
private String googlePlaceId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Place getPlace() {
return place;
}
public void setPlace(Place place) {
this.place = place;
}
public String getGooglePlaceId() {
return googlePlaceId;
}
public void setGooglePlaceId(String googlePlaceId) {
this.googlePlaceId = googlePlaceId;
}
}
当数据库尝试删除旧对象时,会发生此错误。 您可以使用
spring.jpa.show sql=true
检查它发生的确切时刻,但是,如果您更改spring.jpa.hibernate.ddl auto=create
而不是create drop
,您将不再看到这些警告,因为它不会尝试删除不存在的对象
发件人:
create
将生成数据库删除,然后是数据库删除
创造
create drop
在SessionFactory启动时删除架构并重新创建它。
此外,在SessionFactory关闭时删除架构
我认为这与模式生成和实体的错误配置有关。你能发布你的实体及其注释和任何其他与模式相关的配置吗?@niekname我已经添加了实体
GooglePlace
-我发布的配置已经全部存在了-我不知道有任何其他配置。我还检查了我所有的Spring配置Java类——我没有手动设置任何东西。