-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping a calculated property
PostPosted: Thu Mar 03, 2011 4:56 pm 
Newbie

Joined: Fri Jun 26, 2009 2:22 pm
Posts: 6
I need to be able to sort by a property on one of objects. Normally not a problem with HQL. The problem I'm having is that the property I want to sort by isn't represented in the database.

The object(s) looks like this:

Position->Person->(Property)FullName

The problem is that sometimes Position has no person in which case I substitute with the property PositionNumber. So I created a property off of Position called FullName. If Person is there it grabs the FullName property from Person and sends that back. If there's no Person object then I send back the PositonNumber (a string). So I can't say "from Position p order by p.Person.FullName" because Person may be null and I don't know how to map p.FullName since it's not a field in the database. Any suggestions would be greatly appreciated!

Eric


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.