oalexandrino wrote:
Hello all,
I'm already using NHIbernate. It is working fine.
I'm doing a migration code for a old system (NATIVE SQL queries ) to NHIbernate.
It has been done in steps.
Now, we have all native SQL queries as NamedQueries in the HBM file.
We have a lots of ones.
How to rewrite these SQL just using NHibernate features, that is, without any DataBase Specif
Sintax? This is for INNER JOIN QUERIES
how to make these NamedQueries as HBL queries or C#/NHibernate code?
If you're talking about joining between objects which are associated in the object graph and mapped as such you can use the following syntax:
"SELECT a FROM TableA a INNER JOIN a.TableB b WHERE b.Property = :parameter"
If you are joining objects which are not associated in the object graph or mapping file see the following blog post I made:
http://jaychapman.blogspot.com/2007/10/nhibernate-non-mapped-joins.html
I hope that helps!