Joined: Thu Aug 23, 2007 9:52 pm Posts: 9
|
I am new to Hibernation and facing an issue.
I have Table1 and Table2 . Table1 has filed "server" and Table2 has field "machine" . Both means same thing(Can't change schema)
I have a many to one relationship from Table1 to Table 2.
class CTable1 {
@OneToMany
@JoinColumn(name ="server") //XXX could be the problem
private List<CTable2> list;
//get and set for list
}
class CTable2 {
@Id @GeneratedValue
@Column(name="ID")
private Integer id;
@Column(name="machine")
private Integer machine;
// get and set
}
I am getting run time exception when I am trying to call getList() fro CTable1
org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.company.zz.CTable1.list#1]
The above code works fine if column "machine" were named "server" in table2. Can some one please tell me how to create join when both table have different column names.
Thanks,
|
|