I've been struggling with this for quite some time, and didn't get any concrete answers on google. I have many to many relationship between albums and users, for which the join table has an extra field "role" defined. The concrete implementation :
User class :
@Entity
@Table(name="USERS")
public class User {
private long id;
private String userName;
private String password;
private String mailAddress;
private Set<AlbumUser> albumUsers;
// Getters
/**
 * @return the id
 */
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public long getId() {
    return id;
}
/**
 * @return the userName
 */
public String getUserName() {
    return userName;
}
/**
 * @return the password
 */
@Type(type="encryptedString") 
public String getPassword() {
    return password;
}
/**
 * @return the mailAddress
 */
public String getMailAddress() {
    return mailAddress;
}
// Setters
/**
 * @param id the id to set
 */
public void setId(long id) {
    this.id = id;
}
/**
 * @param userName the userName to set
 */
public void setUserName(String userName) {
    this.userName = userName;
}
/**
 * @param password the password to set
 */
public void setPassword(String password) {
    this.password = password;
}
/**
 * @param mailAddress the mailAddress to set
 */
public void setMailAddress(String mailAddress) {
    this.mailAddress = mailAddress;
}
public String toString()
{
    return ("User : " + getUserName());
}
/**
 * @return the albumUsers
 */
//----bidirectional association
@Transient
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.user")
public Set<AlbumUser> getAlbumUsers() {
    return albumUsers;
}
/**
 * @param albumUsers the albumUsers to set
 */
public void setAlbumUsers(Set<AlbumUser> albumUsers) {
    this.albumUsers = albumUsers;
}
}
AlbumUser class : 
@Entity
@Table(name = "ALBUMS_USERS")
@AssociationOverrides({
@AssociationOverride(name = "pk.album", joinColumns=@JoinColumn(name="album_id")),
@AssociationOverride(name = "pk.user", joinColumns=@JoinColumn(name="user_id"))})
public class AlbumUser {
private AlbumUserPK pk = new AlbumUserPK();
private Role role;
@EmbeddedId
private AlbumUserPK getPk()
{
    return pk;
}
private void setPk(AlbumUserPK pk)
{
    this.pk = pk;
}
public void setAlbum(Album album) {
    getPk().setAlbum(album);
}
@Transient
public Album getAlbum() {
    return getPk().getAlbum();
}
public void setUser(User user) {
    getPk().setUser(user);
}
@Transient
public User getUser() {
    return getPk().getUser();
}
/**
 * @return the role
 */
@Enumerated(EnumType.STRING)  
public Role getRole() {
    return role;
}
/**
 * @param role
 *            the role to set
 */
public void setRole(Role role) {
    this.role = role;
}
}
@Embeddable
class AlbumUserPK implements Serializable {
private Album album;
private User user;
/**
 * @return the album
 */
@ManyToOne
public Album getAlbum() {
    return album;
}
/**
 * @param album
 *            the album to set
 */
public void setAlbum(Album album) {
    this.album = album;
}
/**
 * @return the user
 */
@ManyToOne
public User getUser() {
    return user;
}
/**
 * @param user
 *            the user to set
 */
public void setUser(User user) {
    this.user = user;
}
}
Whenever I try to insert/read/... a user, I get the following error :
org.hibernate.PropertyNotFoundException: Could not find a setter for property empty in class java.util.Set
I guess this has something to do with the set of AlbumUsers,I'm keeping in the User class... I tried to make this field transient, but to no avail...
Has anybody come across similar errors?
Thanks...
 
    