stackoverflow
@Entity
public class UserDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
....
@OneToOne(cascade = CascadeType.ALL)
private UserOffer userOffer;
.....
//getters and setters
----------------------------------------------------
@Entity
public class UserOffer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
.....
@OneToOne(cascade= CascadeType.ALL)
private DetailsOffer detailsOffer;
.....
----------------------------------------------------
@Entity
public class DetailsOffer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@OneToMany(cascade = CascadeType.ALL, mappedBy="detailsOffer")
private List<Product> products;
----------------------------------------------------
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private PetType petType;
private int petNumber;
@ElementCollection
private List<String> goodies;
private String petDescribtion;
private BigDecimal price;
@ManyToOne
@JoinColumn(name = 'id_details_offer')
private DetailsOffer detailsOffer;