Topic: 这样hsql语句怎写?

  Print this page

1.这样hsql语句怎写? Copy to clipboard
Posted by: lisycn
Posted on: 2007-07-26 15:44

表 a:

id (主键) a1 a2

1 a aa

2 aa aaaa

表 b:

id (主键) a.id(外键) b1 b2

1 1 b bb

2 1 bb bbbb

a( id)与b(a.id)表一对多关系 ,现在要删除b表的某一行记录(即b.id=2这一行记录),只知道a.id(外键) 和 b1或 b2

hibernate 如何写hsql

2.Re:这样hsql语句怎写? [Re: lisycn] Copy to clipboard
Posted by: snowbug
Posted on: 2007-08-02 02:55

delete from ClassB b
where b.classA = :classA and b.b1 = :b1

然后传入参数 :classA 和 :b1

:classA 通过 session.get(a.id) 取得。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923