New Posts New Posts RSS Feed: Querying  Custom Properties of Business Objects
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Querying Custom Properties of Business Objects

 Post Reply Post Reply
Author
jozza View Drop Down
Newbie
Newbie


Joined: 11-Jul-2007
Posts: 25
Post Options Post Options   Quote jozza Quote  Post ReplyReply Direct Link To This Post Topic: Querying Custom Properties of Business Objects
    Posted: 11-Jul-2007 at 10:50pm
Hi,
Is it possible to somehow query the PersistenceManager based on the value of some kind of custom property on a business object? eg. If we have a custom property called Age, is there a way to return all entities with an Age greater than say, 50?
 
I can sort of see how this sort of query would be a problem, since if the Persistence Manager needs to go back to the datasource to retrieve the data it probably can't create the appropriate query.
 
So the next question is, if we do need to have a query of this type what is the best way of retrieving data from the PersistenceManager?  One solution that I've thought of is to query the data as best I can based on actual EntityColumns and then given the EntityList write a delegate with the predicate based on the custom properties. I'm not sure how efficient this would be in large record sets though.
 
I'd be interested in hearing any other solutions. Thanks.


Edited by jozza - 11-Jul-2007 at 10:51pm
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 12-Jul-2007 at 8:45am
Jozza,
 
No.  It is not possible to make a query using a custom property.  The problem, as you correctly surmise, is that the query may need to go back to the database, and the database has no understanding of custom properties.  We have thought of supporting cache-only queries that use custom properties, but that is an extremely difficult feature to implement.  We may support cache-only queries that support custom properties after we support Orcas, but I make no promises.
 
The solution that you propose of using a predicate on a query that contains only entity columns is often your best approach.
 
Hera are some other solutions:
 
In your example of Age, you could translate the query to an equivalent query that used BirthDate
 
You could use a StoredProcRdbQuery
 
You could use a View
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down