Erro em relacionamento com schemas diferentes no postgres usando SpringBoot

0 respostas
postgresqlspringhibernate
E

Olá a todos, estou com o seguinte problema:
cirei um banco chamado Teste e dentro tem dois schemas: schema1 e schema2.
Dentro de cada schema tem uma tabela:
schema1 -> tabela1
schema2 -> tabela2

Acontece que se tento fazer um relacionamento com SpringBoot usando annotations entre a tabela1 e tabela2, elas nao se enxergam. com sql puro, consigo, basta informar a tabela com schema.
schema1.tabela1
schema2.tabela2.

Mas como faco isso o Spring Boot? eis me codigo.

@Entity @Table(schema = "schema_1") 
 public class Tabela1 implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) 
 private Integer id;
 private String name;
 @OneToMany(mappedBy = "tabela1")
 private List<Tabela2> tabela2= new ArrayList<>();
 publicTabela1() {
    }
 }




   @Entity    
   @Table(schema = "schema_2")
   public class Tabela2 implements Serializable {

   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    private String number;
   @ManyToOne
   @JoinColumn(name = "fk_tabela1")
   private Tabela1 tabela1;

      public Tabela2() {
         }
     }
Criado 20 de julho de 2018
Respostas 0
Participantes 1