Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] QueryByExamplePolicy

Query by example is only designed for simple queries.  Once you want to start
applying functions you need to use a normal query (JPQL, Criteria,
Expressions).

You could potentially subclass your own QueryByExamplePolicy to build the
Expression you desire.



tbianchi wrote:
> 
> I have a db field (varchar) that may or may not contain leading and
> trailing spaces.
> I would like to use query-by-example using this field as part of the
> object's example criteria but I need some way to tell the example to trim
> the field. A simple sql query would use: trim(name) = 'bob'
> 
> Is there any way to configure the query by example to do this? Maybe using
> some flavor of QueryByExamplePolicy? 
> 
> As always, thanks in advance.
> Tony
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/QueryByExamplePolicy-tp30284164p30297758.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top