-->
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: when i dont have a column...
PostPosted: Wed Aug 31, 2005 8:01 am 
Newbie

Joined: Wed Aug 31, 2005 7:51 am
Posts: 3
Folks,

I have a query like this:

Code:
  select
    property1,
    property2,
    (select sum(property3) from table2 where property4=table1.property4) as myProperty
  from table1
[/quote]

I donr know how i make a HQL for the myProperty...

Sorry my bad english... i am from Brasil.[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 9:46 am 
Regular
Regular

Joined: Thu Dec 02, 2004 7:11 am
Posts: 85
You can use formula attribute. Quote from reference:

Quote:
<property name="totalPrice"
formula="( SELECT SUM (li.quantity*p.price) FROM LineItem li, Product p
WHERE li.productId = p.productId
AND li.customerId = customerId
AND li.orderNumber = orderNumber )"/>


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.