由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - hibernate question
相关主题
EHCache --- hibernate questionJAVA技术更新太快了!
About Hibernate.Net developer doing Java
想自学J2EEany tool can automatically generate mapping xml file of hibernate?
Hibernate queryDo I need to implement equals and hashCode in domain object
hibernate求助Hibernate in Eclipse
Questions on EJB3 Persistence/Hibernatedefault value in hibernate?
j2ee现在流行什么?How do I do flush in Spring service layer with hibernate?
ask a spring framework question搞不懂为什么hibernate为什么这么流行?
相关话题的讨论汇总
话题: hibernate话题: join话题: queryb话题: table话题: where
进入Java版参与讨论
1 (共1页)
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
1 (共1页)
进入Java版参与讨论
相关主题
搞不懂为什么hibernate为什么这么流行?hibernate求助
一个读log以后的问题 spring + hibernateQuestions on EJB3 Persistence/Hibernate
web application 如何从数据库取数据?j2ee现在流行什么?
[合集] 这个annotation,...ask a spring framework question
EHCache --- hibernate questionJAVA技术更新太快了!
About Hibernate.Net developer doing Java
想自学J2EEany tool can automatically generate mapping xml file of hibernate?
Hibernate queryDo I need to implement equals and hashCode in domain object
相关话题的讨论汇总
话题: hibernate话题: join话题: queryb话题: table话题: where