Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- @Inheritance(strategy = InheritanceType.JOINED)
- public class Aprendiz extends Pessoa {
- @OneToOne(cascade = {CascadeType.ALL})
- private Diario diario;
- //get, set, hashcode...
- }
- @Entity
- public class Diario implements Serializable{
- private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
- @OneToOne(mappedBy = "diario")
- private Aprendiz aprendiz;
- @ElementCollection(fetch = FetchType.EAGER)
- @MapKeyColumn(name = "data")
- @Column(name = "texto")
- @CollectionTable(name = "diario", joinColumns = @JoinColumn(name = "id"))
- private Map<LocalDate, String> entrada = new HashMap<>();
- //get, set, hashcode...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement