hibernate多条数据删除;临时表别名
你慧快乐 2015-10-22 05:17:23 使用delete from User as u where u.userId in (1,2,3)删除多条数据,生成了sql如下:
insert
into
HT_user
select
user0_.userId as userId
from
studentManager.user user0_
left outer join
users_roles user0_1_
on user0_.userId=user0_1_.userId
where
userId in (
1,2,3
)
报错:Column 'userId' in where clause is ambiguous
应该就是指where 条件中的userId不明确,但是为什么没有加别名呢,普通的查询更新,不管是单表操作还是多表关联操作都是加别名的,为什么这个就没有呢,还是问题就不在这里,或是有能实现一条sql就能删除多个记录的方法也可提出,我不想遍历逐条删除,希望能给点指点。