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.  [ 3 posts ] 
Author Message
 Post subject: How to implement this query?
PostPosted: Wed Aug 24, 2005 2:03 pm 
Newbie

Joined: Wed Jun 08, 2005 1:09 pm
Posts: 3
Hi All,

1) This query returns columns from two tables
2) This query used join condition with two tables.

select m.nbr_mrtg_fm, t.cnt_conv_amtn FROM
mrtg_terms t, mrtg m WHERE
t.id_mrtg = m.id_mrtg AND t.dt_eff_end is null
and t.code_data_srce = 'MID'

This query executed in Rapid sql.

Here tables are
a) mrtg_terms
b) mrtg

Pl give me steps to implement.

Thanks
[/b]


Top
 Profile  
 
 Post subject: multiple options
PostPosted: Wed Aug 24, 2005 2:47 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
1. you can use the query as is with Hibernate native query support;

http://www.hibernate.org/hib_docs/refer ... rysql.html
2. if your object MortgTerms object has Mrtg field that is mapped as many-to-one then HQL query is simple as

select mt.m.property, mt.property from MortgTerms mt where .....
3. If they are not related in the mapping files then HQL would look almost like SQL.

I suggest going with option #1 and use {EntityName} aliases to use as table names, or if DB schema is stable then simply use table names.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 11:29 pm 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi


How about Criteria API with Resctriction??????????

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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