-->
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: Formula to retuen Object
PostPosted: Tue Nov 10, 2009 1:53 am 
Newbie

Joined: Wed Feb 07, 2007 8:26 pm
Posts: 17
Dears,

Is it possible to use formula to return Object.

For example:
I need to have the last Order in Product->*Order (One-to-Many) relation.

I did the following:
Code:
<one-to-one name="lastOrder" class="Order"  >
            <formula>   
            (select * from Order o2 where o2.id = 128)
            </formula>
</one-to-one>


This returns: ORA-00913: too many values error.

Any ideas?
Thanks in advace
Abbas


Top
 Profile  
 
 Post subject: Re: Formula to retuen Object
PostPosted: Tue Nov 10, 2009 4:12 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Try to select only the id instead of "*".

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject: Re: Formula to retuen Object
PostPosted: Wed Nov 11, 2009 1:16 am 
Newbie

Joined: Wed Feb 07, 2007 8:26 pm
Posts: 17
Dear mmerder,

Thanks a lot for your response.
I will try this but will all fields get populated on the first access?

Thanks again
Abbas


Top
 Profile  
 
 Post subject: Re: Formula to retuen Object
PostPosted: Wed Nov 11, 2009 4:54 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Depends on how you have mapped Order (lazy/eager fields).

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
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.