如何在hibernate和postgresql中使用多模式

如何在hibernate和postgresql中使用多模式,hibernate,spring-boot,hibernate-criteria,Hibernate,Spring Boot,Hibernate Criteria,我正在用hibernate、Spring boot和postgresql开发一个应用程序。在我的数据库中有3个模式(“auth”、“common”、“app”)和不同的表。不同模式下的表之间存在着相互关系。例如,我有以下两个实体: @Entity @Table(name = "USERS" , schema="auth") public class User { @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(unique = t

我正在用hibernate、Spring boot和postgresql开发一个应用程序。在我的数据库中有3个模式(“auth”、“common”、“app”)和不同的表。不同模式下的表之间存在着相互关系。例如,我有以下两个实体:

@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 {

}
下面是我的hibernate配置的一部分:

@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;
    }
}
现在我的问题是,当我尝试使用hibernate会话工厂保存新用户时,会出现以下异常:

org.postgresql.util.PSQLException: ERROR: relation "app.users" does not exist
所以hibernate似乎不能同时处理多个模式。有没有办法解决这个问题并使这个例子起作用