views:

310

answers:

2

Dear ladies and sirs.

Does anyone know of an existing solution to translate a LINQ Expression to HQL statement?

Thanks in advance to all the good samaritans out there.

P.S.

We already use Linq to NHibernate. However, it only works for select statements, whereas HQL is good for other statement kinds, like delete. So, Linq to NHibernate is not the answer.

+2  A: 

Linq to nhibernate has just been released . Does that help?

John Nolan
I am using it already. It can only do selects, while HQL can be used in other operations, like delete. So no, it does not help.
mark
oh ok. suggest you edit your question as appropriate.
John Nolan
A: 

Use LINQ for querying, HQL for delete and update. Even Criteria can still be useful sometimes instead of LINQ.

It's not an either/or situation, you can and should pick the best tool for each job.

Mauricio Scheffer
HQL is NHibernate specific and as such is the server side DAL implementation detail. I do not want it to "leak" to the client side, which is the one requesting to delete some entities. So, the client specifies a linq expression. When the request is fetch - simple, because there is linq to nhibernate, which translate it to criteria and then selects by it. However, there is no delete statement by criteria and that is a problem.
mark
That's another question altogether... please create another question to address that. When using multiple tiers IMO you shouldn't allow a client to send its own linq expression.
Mauricio Scheffer
http://stackoverflow.com/questions/1330432/in-a-multitier-application-should-a-client-be-allowed-to-send-its-own-linq-expres
mark