I'm trying to query the collection "followees" in my Spitter class. But I'm not sure how to. And if there's a way, is it possible for each instance in the list to return an attribute instead of Followee object?
Spitter:
Followee:
Spitter:
Code:
@Entity
@Table(name="SPITTER")
public class Spitter implements Serializable {
@Id
@GeneratedValue
@Column(name="ID")
private int id;
@Column(name="USERNAME")
private String userName;
@Column(name="PASSWORD")
private String password;
@Column(name="FULLNAME")
private String fullName;
@Column(name="EMAIL")
private String email;
@ElementCollection
@CollectionTable(name = "FOLLOWEE", joinColumns = @JoinColumn(name = "SPITTER_ID"))
private List<Followee> followees = Lists.newArrayList();
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "SPITTER_ID")
private List<Spittle> spittles = Lists.newArrayList();
//getters/setters/ hash/equals etc
Code:
@Embeddable
public class Followee implements Serializable {
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "FOLLOWEE_ID", insertable = false, updatable = false)
private Spitter spitter;