Discussion:
[nhusers] why does nHibernate has so many querying apis?
Filip Kucharczyk
2018-03-29 20:54:40 UTC
Permalink
Hi,

Why does nHibernate has so many APIs to do queries? There is the HQL,
Criteria API, QueryOver and a Linqu provider.
Isin't the Linq provider all we need?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Rein Verberne
2018-03-30 12:43:11 UTC
Permalink
It's nice to have a choice. For example when the query is dynamic (or even
user definable) then you can compose it by combining/nesting various kinds
of criterion objects. In LINQ this would require creating expressions at
runtime which is a pain.
Post by Filip Kucharczyk
Hi,
Why does nHibernate has so many APIs to do queries? There is the HQL,
Criteria API, QueryOver and a Linqu provider.
Isin't the Linq provider all we need?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Craig vN
2018-03-30 22:17:47 UTC
Permalink
If NHibernate was built from scratch today it probably would just have the
Linq provider. But NHibernate, and Hibernate which it is based on, is 16
years old, well before Linq was a thing. The different APIs are a
reflection of different user expectations over time and developing tech
trends.
Post by Filip Kucharczyk
Hi,
Why does nHibernate has so many APIs to do queries? There is the HQL,
Criteria API, QueryOver and a Linqu provider.
Isin't the Linq provider all we need?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Ricardo Peres
2018-04-02 10:40:06 UTC
Permalink
I'm very happy that it has so many querying options. There are things that
can only be expressed in either HQL or SQL, for example, query-only
properties. Plus the dynamic nature of strings lends itself much better to
some scenarios.

RP
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Felipe Oriani
2018-04-02 12:52:25 UTC
Permalink
I think it is important to know all APIS and know how to choose each one on
the best scenario. For sample, I think LINQ is more productive for trivials
queries, it i easy to write and works fine (improving the linq support and
getting better on each new version of NH). For dynamic queries, QueryOver
and Criteria can be the right choice, because they provide a best support
to write dynamic statement, in additional to be easer than linq expressions
tree. For sample, I have implemented a Kendo UI Grid server side support
with QueryOver and it works perfectly, amazing job the NH development team
have made with QueryOver. HQL is fine to write everything given it looks
like SQL, and I enjoy writting non-default sql update, for sample:
"update Entity set field=:fieldValue where code=:code and age > 0".
Post by Ricardo Peres
I'm very happy that it has so many querying options. There are things that
can only be expressed in either HQL or SQL, for example, query-only
properties. Plus the dynamic nature of strings lends itself much better to
some scenarios.
RP
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
______________________________________
Felipe B Oriani
***@gmail.com
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Filip Kucharczyk
2018-04-05 08:48:11 UTC
Permalink
thnaks for all the answers, this makes sense to me now :)
Post by Felipe Oriani
I think it is important to know all APIS and know how to choose each one
on the best scenario. For sample, I think LINQ is more productive for
trivials queries, it i easy to write and works fine (improving the linq
support and getting better on each new version of NH). For dynamic queries,
QueryOver and Criteria can be the right choice, because they provide a best
support to write dynamic statement, in additional to be easer than linq
expressions tree. For sample, I have implemented a Kendo UI Grid server
side support with QueryOver and it works perfectly, amazing job the NH
development team have made with QueryOver. HQL is fine to write everything
given it looks like SQL, and I enjoy writting non-default sql update, for
sample: "update Entity set field=:fieldValue where code=:code and age >
0".
Post by Ricardo Peres
I'm very happy that it has so many querying options. There are things
that can only be expressed in either HQL or SQL, for example, query-only
properties. Plus the dynamic nature of strings lends itself much better to
some scenarios.
RP
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
______________________________________
Felipe B Oriani
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Loading...