Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. @Entity
  2. @Table(uniqueConstraints = @UniqueConstraint(columnNames = "cpf"))
  3. public class Cliente {
  4. ...
  5. @Id
  6. @GeneratedValue(strategy = GenerationType.IDENTITY)
  7. @Column(name = "cliente_id")
  8. private Long codcli;
  9.  
  10. @OneToMany(mappedBy = "clienteAssociado", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
  11. private List<Cartao> cartoes;
  12. ...
  13. }
  14.  
  15. @Entity
  16. public class Cartao{
  17. ...
  18. @ManyToOne
  19. @JoinColumn(name = "cliente_id")
  20. private Cliente clienteAssociado;
  21. ...
  22. }
  23.  
  24. <Clientes>
  25. <Cliente> <!-- I can have many 'cliente' in the file -->
  26. ... Atributes
  27. <Cartoes>
  28. <Cartao> <!-- I can have many 'cartao' in the file -->
  29. ...Atributes
  30. </Cartao>
  31. </Cartoes>
  32. </Cliente>
  33. </Clientes>
  34.  
  35. SELECT * FROM CLIENTE;
  36. CLIENTE_ID CPF IDADE NOME SEXO
  37. 1 value value value value
  38. 2 value value alue value
  39.  
  40. SELECT * FROM CARTAO;
  41. CARTAO_ID BANDEIRA LIMITE SEGMENTO CLIENTE_ID
  42. 1 value value value null <- Here is my problem
  43. 2 value value value null
  44. 3 value value value null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement