hi,
I am new to hibernate. After some reading and practise, I have got a basice understanding of hibernate and currently develeping a little application use it. However, I encounter a problem and don't know how to deal with it.
In my application, there is a table A(id,...) and B(id,...),and a many to many jointable C(a_id,b_id). This is quite simple, and the code fragment is something as following:
@Entity
@Table(name = "A")
public class Item extends BaseObject {
private Long id;
private Set<B> bs = new HashSet<B>();
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
...
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "C", joinColumns = { @JoinColumn(name = "A_id") }, inverseJoinColumns = @JoinColumn(name = "B_id"))
public Set<B> getBs() {
return bs;
}
...
}
Now, I need to add a new column to table C, which produce C(a_id,b_id,Commments).
Since C is a join table, there are no class definiton for it in my application, what should I do?
I think this is a common scene in many applicaton, so there must be some ways to achieve this in hibernate.
Any suggestion is appreciated and thanks in advance.
|