Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- @Table(uniqueConstraints = @UniqueConstraint(columnNames = "cpf"))
- public class Cliente {
- ...
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "cliente_id")
- private Long codcli;
- @OneToMany(mappedBy = "clienteAssociado", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
- private List<Cartao> cartoes;
- ...
- }
- @Entity
- public class Cartao{
- ...
- @ManyToOne
- @JoinColumn(name = "cliente_id")
- private Cliente clienteAssociado;
- ...
- }
- <Clientes>
- <Cliente> <!-- I can have many 'cliente' in the file -->
- ... Atributes
- <Cartoes>
- <Cartao> <!-- I can have many 'cartao' in the file -->
- ...Atributes
- </Cartao>
- </Cartoes>
- </Cliente>
- </Clientes>
- SELECT * FROM CLIENTE;
- CLIENTE_ID CPF IDADE NOME SEXO
- 1 value value value value
- 2 value value alue value
- SELECT * FROM CARTAO;
- CARTAO_ID BANDEIRA LIMITE SEGMENTO CLIENTE_ID
- 1 value value value null <- Here is my problem
- 2 value value value null
- 3 value value value null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement