c******n 发帖数: 4965 | 1 A ---- B is many to many relation
so in DB there is a A_B mapping table.
now I want to do hql : " from A a where a.setsOfB = :queryB " and do
session.createQuery("from A a where a.setsOfB = :queryB " ).setEntity(
oneInstanceOfB).list()
Hibernate does a 3-table JOIN,
select * from A a join A_B ab on a.B_ID = ab.B_ID join B b on b.B_ID = ab.B_
ID where b.B_ID = [ oneInstanceOfB.getId() ]
but instead, supposedly it should be able to just JOIN A and A_B table,
I set lazy=true everywhere, and from TRACE logging, I see that javassist is
being used. is there any way to let Hibernate be smarter?
Thanks |
|