0

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: ...
1
  • @ScaryWombat It is not the schema, it is the database (a.k.a. catalog in JDBC terminology) Commented Dec 23, 2022 at 12:11

1 Answer 1

1
spring:
  datasource:
    hikari:
      schema: ${database.schema}
  liquibase:
    default-schema: ${database.schema}
  jpa:
    properties:
      hibernate:
        default_schema: ${database.schema}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.