0
我目前正在使用Spring-MVC和hibernate。我在数据库,表1和表2中有2个表。 Table1与table2有一对多的关系。当我使用查询从Table1及其Table2中的子项中删除一行的应用程序时,出现错误,表示关系Table1_table2不存在。关系table1_table2不存在Postgres
Code :
@Table(name="table1")
class user{
@OneToMany
public Set<Accounts> accounts;
//Remove method
Query query = session.createQuery("From User as u LEFT JOIN FETCH u.accounts WHERE u.id="+id)
//then I use a for loop to go through the Accoutns and remove the accounts.
}
@Table(name="Table2")
class accounts{
@manyToOne
public User user;
}
我刚开始再做一次。会做的。谢谢。 – 2014-09-23 06:57:41
欢迎大哥 – 2014-09-23 08:39:57