I've done a lot of searching on this... haven't found my answer yet.
A simplified representation of my problem :
Code:
@Entity
@Table(name="A")
Public Class A {
private Long id;
@Id
@GeneratedValue
@Column(name="a_id")
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
protected List<B> blist = new ArrayList<B>();
@OneToMany(cascade=CascadeType.ALL)
@JoinTable(name="ab_join", joinColumns=@JoinColumn(name="fk_a"), inverseJoinColumns=@JoinColumn(name="fk_b"))
public List<B> getBlist() { return blist; }
public void setBlist(List<B> list) { blist = list; }
}
@Entity
@Table(name="B")
Public Class B {
private Long id;
@Id
@GeneratedValue
@Column(name="b_id")
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
private String aProperty;
@Column(name="a_property")
public String getAProperty() { return aProperty; }
public void setAProperty(String property) { aProperty = property; }
}
When I attempt to create A, the instance of A is created and the properties of A that are in Table A (only 'id' in the above example) are properly persisted. The collection (blist in the example) appears to be created, and I can read it from the session, but it is not persisted/saved to the join table. If I try to force a persist/saved on the collection property, I get the Mapping Exception : "Unknown Entity: java.util.ArrayList".
People have reported some similar issues in other threads, but I haven't found a solution.
thanks much!