-->
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: DetachedCriteria --> URL: bookmarkable?
PostPosted: Sat Jan 14, 2006 9:55 pm 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
Hi,

A list of search results are retrieved using DetachedCriteria. Is it possible to make detached criteria be part of a URL so that user can bookmark the query results page?

DetachedCriteria object --> string (part of URL)
--> DetachedCriteria object

Thanks!

David


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 15, 2006 4:35 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
There is no support in hibernate for that sort of thing. However, the complete setup of a Criteria is reconstructable from its toString() method, so if you want to write a Criteria ->URL attributes -> Criteria lexer/parser, the hibernate tools project would love to hear from you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 16, 2006 2:50 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
Can I just put
String criteria-string =aCriteria.toString()
on the URL?

getResults?queryString=[criteria-string]

The servlet "getResults" can re-construct criteria object from criteria-string.

Does this make sense? One concern is that the string may be very very long.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 16, 2006 4:23 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Print out the string and play with it. You won't be able to use it directly because it's not in a format compatible with URL parameter strings, but it will be relatively easy to use StringTokenizer to parse the string, you won't have to get any more complicated than that.

There are alternatives, of course. The best would probably to put an API over DetachedCriteria that "natively" supports URL parameter strings. If you write a standard API that convert in both directions, then all your needs are met.


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.