Here is the user class (snippet) from the user class:
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "userTable")
public Set<UserDetail> getUserDetails()
{
return this.userDetails;
}
public void setUserDetails(Set<UserDetail> userDetails)
{
this.userDetails = userDetails;
}
And here is the UserDetailsId
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name = "UserID", unique = true, nullable = false, insertable = false, updatable = false)
public User getUserTable()
{
return this.userTable;
}
public void setUserTable(User userTable)
{
this.userTable = userTable;
}
When I try to fetch the user details (and I know the data is in the database), it returns an empty set:
User user = new UserDAO().findByUserName("Monkey").get(0); // works fine
UserDetail ud = user. getUserDetails().iterator().next(); // returns null
Any suggestions?
Thanks in advance
Frank