These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to rewrite INNER JOIN SQL just using NHibernate ?
PostPosted: Wed Oct 31, 2007 1:23 pm 
Beginner
Beginner

Joined: Wed Aug 29, 2007 1:25 pm
Posts: 26
Location: Recife, PE, Brazil
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?


Top
 Profile  
 
 Post subject: Re: How to rewrite INNER JOIN SQL just using NHibernate ?
PostPosted: Fri Nov 02, 2007 9:48 am 
Senior
Senior

Joined: Thu Feb 09, 2006 1:30 pm
Posts: 172
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.