开发者

Nhibernate : is it possible to make HQL generate SQL query with JOIN

This is my problem. I have a many-to-one relationship from a accountlist t开发者_运维问答o a client

When i want to list accounts with client name, my HQL query ("From accountlist") generates thousands SQL queries, one for the accountlist and one for each client.

Is it possible, with HQL to force to make juste one sql request with a join ?

Thank's you by advance :-)


Yes. If you are writing a query in HQL:

"from accountlist a join fetch a.client"

or similar. NHibernate's fetch strategies define how this sort of data is retrieved. If you specify to fetch with a JOIN, that's what it does.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜