简体   繁体   中英

Postgres database "information_schema" in JPA

I've created project using Postgres database. Tables are created in information_schema, that's why I need to add schema argument @Table or @JoinTable , like this:

@Entity
@Table(name = "book",  schema = "information_schema")
public class Book { ...
@ManyToMany
@JoinTable(
    name = "book_genre",
    schema = "information_schema",
    joinColumns = @JoinColumn(name = "book_id"),
    inverseJoinColumns = @JoinColumn(name = "genre_id"))
private List<Genre> genres = new ArrayList<>();

What setting should I change to avoid this? Maybe I should set it in settings of my application?
application.yml looks like this:

spring:
  datasource:
    url: "jdbc:postgresql://localhost:5432/postgres"
    username: ...
    password: ...
spring:
  datasource:
    hikari:
      schema: ${database.schema}
  liquibase:
    default-schema: ${database.schema}
  jpa:
    properties:
      hibernate:
        default_schema: ${database.schema}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM