-->
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.  [ 4 posts ] 
Author Message
 Post subject: Query including a left join between fields
PostPosted: Wed Aug 17, 2005 8:53 am 
Hi folks,

I got a problem when I want to do a query that includes
a left join between two fields.
Those two fields are not foreign keys.
There is no error raised but there is no result in return and
in the log, no SELECT command has been generated which is usely the case.

I saw on a Hibernate forum that it was not possible to do a left join between non foreign keys; is it the same with NHibernate ?

Thx
DBSamourai


Top
  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 5:24 pm 
Beginner
Beginner

Joined: Wed Jun 29, 2005 10:40 am
Posts: 30
Location: denver, co
Can you post your hql, so we can figure out what is wrong?

I've never been able to figure out how to join on two fields, unless you use the new native sql queries.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 5:30 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
Quote:
I saw on a Hibernate forum that it was not possible to do a left join between non foreign keys; is it the same with NHibernate ?

Yes, it's the same. NHibernate is a port of Hibernate.


Top
 Profile  
 
 Post subject: HQL
PostPosted: Fri Aug 19, 2005 3:34 am 
Here is my HQL:

Code:
SELECT ti.Number, tei.Date FROM TransactionInfo ti LEFT JOIN TransactionStateInfo tei ON ti.Id = tei.TransactionId


I tried with and without "ON", same result.

My entity class is:
Code:
class TransactionInfo
{
    int Id;
    long Number;
    ....
}

class TransactionStateInfo
{
    DateTime Date;
    int TransactionId;
    ....
}


The reason why i didn't do a <many-to-one> between TransactionInfo and TransactionStateInfo is that I want to load separetely "transactions" and their "transactionStates" :
- MyServices.GetTransactionById( .... )
- MyServices.GetTransactionStateByTransactionId( ... )


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.