title: How to use multiple Schema in hibernate and postgresql
body: <p>I'm developing an application with hibernate, Spring boot and postgresql. in my database there is 3 schema ("auth" , "common" , "app") with different tables. and tables in different schema has relation with each other. for example i have two following entities:</p>
  
  <pre><code>@Entity
  @Table(name = "USERS" , schema="auth")
  public class User {
  
     @ManyToOne(cascade = CascadeType.ALL)
     @JoinColumn(unique = true , nullable = false)
     private Profile profile;
  
  }
  
  @Entity
  @Table(name = "PROFILES" , schema="common")
  public class Profile {
  
  }
  </code></pre>
  
  <p>and here is part of my hibernate configuration :</p>
  
  <pre><code>@Configuration
  public class DatabaseConfiguration {
     .......
  
     @Bean
     public LocalSessionFactoryBean sessionFactory(){
         LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
  
         .........
  
         Properties properties = new Properties();
         properties.put("hibernate.default_schema", "app");
  
         ......
  
         factoryBean.setHibernateProperties(properties);
         return factoryBean;
      }
  }
  </code></pre>
  
  <p>now my problem is when i try to save a new user using hibernate session factory i get this exception :</p>
  
  <pre><code>org.postgresql.util.PSQLException: ERROR: relation "app.users" does not exist
  </code></pre>
  
  <p>so it seems hibernate can't work with multiple schema at the same time. is there any way to solve this problem and make this example work?</p>