-->
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.  [ 5 posts ] 
Author Message
 Post subject: Own join for criteria API
PostPosted: Wed Apr 26, 2006 5:11 am 
Newbie

Joined: Wed Apr 26, 2006 5:01 am
Posts: 3
My accident: I want to calculate summary cost of orders in different currencies. I have to join tables with orders and currency rates. Objects Order and CurrencyRate doesn't have any associations. But Criteria class joins tables only with associations in models.

What can you to advise?


Top
 Profile  
 
 Post subject: Re: Own join for criteria API
PostPosted: Wed Apr 26, 2006 8:08 am 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
e.schava wrote:
My accident: I want to calculate summary cost of orders in different currencies. I have to join tables with orders and currency rates. Objects Order and CurrencyRate doesn't have any associations. But Criteria class joins tables only with associations in models.

What can you to advise?


you can use either Criteria API or HQL and pass entity IDs explicitly:
in HQL something like
select r from Orders o, Rates r where o.id=ORDERID and r.orderid=ORDERID and ....

_________________
Please don't forget to give credit, if my posting helped to solve your problem.


Top
 Profile  
 
 Post subject: Re: Own join for criteria API
PostPosted: Wed Apr 26, 2006 8:14 am 
Newbie

Joined: Wed Apr 26, 2006 5:01 am
Posts: 3
axismundi wrote:
you can use either Criteria API or HQL and pass entity IDs explicitly:
in HQL something like
select r from Orders o, Rates r where o.id=ORDERID and r.orderid=ORDERID and ....



Thanks.. I always can use HQL but it is very complicated when I create query dinamically - criterions from user form

But can I do it using Criteria class?


Top
 Profile  
 
 Post subject: Re: Own join for criteria API
PostPosted: Wed Apr 26, 2006 10:05 am 
Senior
Senior

Joined: Mon Aug 22, 2005 5:45 am
Posts: 146
e.schava wrote:
axismundi wrote:
you can use either Criteria API or HQL and pass entity IDs explicitly:
in HQL something like
select r from Orders o, Rates r where o.id=ORDERID and r.orderid=ORDERID and ....



Thanks.. I always can use HQL but it is very complicated when I create query dinamically - criterions from user form

But can I do it using Criteria class?


simply use the normal Criteria API and set the id reference manually

http://www.hibernate.org/hib_docs/v3/re ... teria.html

_________________
Please don't forget to give credit, if my posting helped to solve your problem.


Top
 Profile  
 
 Post subject: Re: Own join for criteria API
PostPosted: Wed Apr 26, 2006 10:29 am 
Newbie

Joined: Wed Apr 26, 2006 5:01 am
Posts: 3
axismundi wrote:
simply use the normal Criteria API and set the id reference manually

http://www.hibernate.org/hib_docs/v3/re ... teria.html


I havn't completely understood you. Can you explain more strictly?


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