-->
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.  [ 7 posts ] 
Author Message
 Post subject: Extending the new Query by Example API
PostPosted: Tue Sep 09, 2003 2:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hi,

as we use Query-by-Example very frequently in our application, the new API is allready a huge improvement for us. However we often have example objects where the data entered by the user is used as a prefix of the data to be displayed.

So what we need to do now is to append % to all propertys of the example object. It would be nice if the LIKE-Feature of the Example class could be extended to do this automatically.

We could patch this in easily, is there any need for such a feature, if yes we would submit a patch.

Michael


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 09, 2003 10:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Ah. This is a good idea.


Perhaps an addWildcards() method, or something...?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 2:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
As I am looking into this, I think it might probably be an idea to do include this with LikeExpression, too.

I have the automatic expansion of the value working with the Example-API, and writing some test-cases for it. Cant submit a patch right now, because the sourceforge CVS seems to be not working properly.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 11:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hey, you are working against v21branch, right?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 13, 2003 9:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hm yes, at least I think so :) Example shouldn't be in HEAD yet anyways if I get this right.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 13, 2003 9:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
true!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 13, 2003 4:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I have submitted a patch to JIRA here http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-334

This adds the possibility to add automatic wildcards like this:

Example.create(exampleObject).enableLike(Example.MATCH_ANYWHERE)

You can use MATCH_ANYWHERE, MATCH_PREFIX and MATCH_SUFFIX to create patterns like %xxx%, xxx% and %xxx

I also found a bug with Example.ignoreCase, which actually was not working at all.

Probably it would be useful to delegate not only the sql-String generation but also the generation of the TypedValues to LikeExpression and EqExpression. The way it works now there is some duplicate logic here.

This was my first patch submitted for Hibernate, is the format, etc. correct?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.