-->
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: Select into type safe object: Ordering
PostPosted: Wed Jul 13, 2005 12:09 pm 
Newbie

Joined: Thu Jun 09, 2005 12:47 pm
Posts: 5
I have this HQL statement:
Code:
SELECT new caats.SearchSourceResultDTO(source.id, sourceName.companyName, source.county.name) FROM caats.entity.Source as source inner join source.sourceNames as sourceName

I need to order by companyName, and county.name . When I try to do this:
Code:
SELECT new caats.SearchSourceResultDTO(source.id, sourceName.companyName, source.county.name) as ssrDTO FROM caats.entity.Source as source inner join source.sourceNames as sourceName ORDER BY ssrDTO.id ASC

It fails, even though I have getter "id" in that object. How is it possible to order by a type safe object. I got this idea from the docs where there is an example:
Code:
or as an actual typesafe Java object
select new Family(mother, mate, offspr)
from eg.DomesticCat as mother
    join mother.mate as mate
    left join mother.kittens as offspr


Thanks in Advance,
Jacob[/code]


Top
 Profile  
 
 Post subject: Re: Select into type safe object: Ordering
PostPosted: Wed Jul 13, 2005 12:11 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
jabriscoe wrote:
I have this HQL statement:
Code:
SELECT new caats.SearchSourceResultDTO(source.id, sourceName.companyName, source.county.name) FROM caats.entity.Source as source inner join source.sourceNames as sourceName

I need to order by companyName, and county.name . When I try to do this:
Code:
SELECT new caats.SearchSourceResultDTO(source.id, sourceName.companyName, source.county.name) as ssrDTO FROM caats.entity.Source as source inner join source.sourceNames as sourceName ORDER BY ssrDTO.id ASC

It fails, even though I have getter "id" in that object. How is it possible to order by a type safe object. I got this idea from the docs where there is an example:
Code:
or as an actual typesafe Java object
select new Family(mother, mate, offspr)
from eg.DomesticCat as mother
    join mother.mate as mate
    left join mother.kittens as offspr


Thanks in Advance,
Jacob[/code]


Show the stack trace and mappings and someone might be able to help you.


Top
 Profile  
 
 Post subject: TypeSafeObject even Possible
PostPosted: Wed Jul 13, 2005 2:30 pm 
Newbie

Joined: Thu Jun 09, 2005 12:47 pm
Posts: 5
My question was; How is it possible to order by a type safe object? If you need mapping information, I can supply that however, I don't feel it is relevant. I'm not asking someone to solve my problem, I'm asking if and how it is possible to order/access a type safe object. The exception I'm experiencing is due to me not knowing how to access this type safe object (caats.SearchSourceResultDTO).

Thanks,
Jacob


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.