I think the problem is NH query, not the generated sql. your query asks *count the number of subscribers where username = login* a subscriber on it's own doesn't mean anything to NH. it requires the subclasses. Therefore NH needs to join all the related table that define an entity.
instead you could define the query *count the number of subscriber ids where username = login.* This *might* alter how NH interprets the query. maybe NH would detect that you are only selecting a common property which is contained in a single table and not join the other tables. HQL select count(id) from Subscriber where wwwUserName = :login (you can then convert this to criteria or queryover if you like) remember: the queries you writing via NH are *object* queries that are then translated into sql queries. *not sql queries directly.* If you want the "best" sql then writing sql directly is your best option. otherwise you need to decide what trade offs you can accept between performance and maintainability. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/t4GUSwDbj5cJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
