Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- public class Destination implements Serializable {
- private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- @Column(name="id_destination")
- private Long idDestination;
- //Outros campos...
- @OneToMany(cascade=CascadeType.PERSIST)
- @JoinColumn(name="fk_destination")
- private Set<Image> images;
- //Getter e Setter
- @Entity
- public class Image implements Serializable{
- private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Long id;
- @Column(name="json", length=300)
- private String json;
- @Column(name="tenant_id", insertable=false, updatable=false)
- private Long tenantId;
- public Image(){
- }
- public String getJson() {
- return json;
- }
- public void setJson(String gson) {
- this.json = gson;
- }
- public Long getId() {
- return id;
- }
- public Long getTenantId() {
- return tenantId;
- }
- }
- //Supondo que passo o id via harded-code na qual tenho um um service que irá me retornar os destinos
- Destination destination = dashboardFacade.getDestinationId(4);
- Set<Image> images = destination.getImages();
- @OneToMany(cascade=CascadeType.PERSIST, fetch=FetchType.EAGER)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement