1
I have two tables in postgresql:
schema1.immobile
idt_imovel | int
cod_imovel | string
nome_imovel | string
etc...
schema2.declaration
idt_declaracao | int
cod_imovel | string
status | string
etc...
The two tables contain the column cod_imovel
but there is no relationship between the tables.
I have the two tables mapped with Hibernate, the classes Imovel
and Declaracao
.
For each entity of the class Imovel
I need to know the status of the statement.
Is there any way to "force" a relationship in Hibernate even without the relationship existing in the bank?
I need something like:
@Entity
@Table(name = "imovel", schema = "schema1")
public class Imovel extends GenericModel {
@Id
@Column(name="idt_imovel")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "imovel_seq")
@SequenceGenerator(name = "imovel_seq", sequenceName = "integracao_lotes.imovel_idt_imovel_seq", allocationSize = 1)
public Integer id;
@Column(name="nome_imovel")
public String nomeImovel;
@Column(name="cod_imovel")
public String codigo;
@relacionamentofake //aqui precisa existir uma forma de mapear a tabela declaracao
public Declaracao declaracao
In case, to know which property is related to which declaration, use the column
cod_imovel
, right? Also, edit your question and place the classDeclaração
and tell me the cardinality of the relationship, please.– Felipe Marinho