Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.1/3.2
hi, i have a simple oneToMany Association,
project -->* ChangeHistoryEntry
through hibernate-Annotation can auto. create 3 tables, project-Table, ChangeHisEntry-Table, and a project_changehistoryentries(association Table).
here is the code in project.java:
@OneToMany(targetEntity = ChangeHistoryEntry.class)
@JoinTable(
name="pro_changehistoryentries",
// joinColumns = { @JoinColumn( name="PROJECT", nullable = false) },
joinColumns = { @JoinColumn( name="PROJECT", nullable = false) },
inverseJoinColumns = @JoinColumn( name="CHANGE_HISTORY_ENTRY")
)
//or default @OneToMany
private Collection <ChangeHistoryEntry> changeHistoryEntries = new HashSet<ChangeHistoryEntry> (0); //1 -> *
public Collection getChangehistoryentrieses() {
return this.changeHistoryEntries;
}
public void setChangehistoryentrieses(Collection<ChangeHistoryEntry> changeHistoryEntries) {
this.changeHistoryEntries = changeHistoryEntries;
}