1
How do I map with Hibernate @OneToOne
and save only if the information has data in the related table?
Example:
public class ObservacaoPessoa {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Integer id;
public Integer PessoaId;
public String TextoObservacao;
}
public class Pessoas {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Integer id;
public String Nome;
public ObservacaoPessoa Obs;
}
I want to make Pessoas.Save
but only record the Obs
if any value has been reported.
I believe this treatment should be done at the time of saving the entity.
– Roknauta