You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by is_maximum <mn...@gmail.com> on 2009/01/18 16:00:13 UTC

problem/bug with query parameters using LIKE operand

Hello

I have a tree structure in a table and in order to high performance we
featured it with a position field or so-called material path. In a specific
state we have a position say, 1.1.2.3.1 and we need all its parent nodes to
the root, in this example we need positions: 1 - 1.1 - 1.1.2 - 1.1.2.3 and
the same 1.1.2.3.1

to get this result the query should be like this:

select e from MyTreeTable as e
	where ?1 like CONCAT(e.position, '%') 
	and ?2 not like e.position 

[params: ?1 = '1.1.2.3.1' and ?2 = '1.1.2.3.1%' ]

But unfortunately this query doesn't work. OpenJPA complains if I bring the
parameter before LIKE keyword while in all databases we can use this syntax.
if we substitute the operands of the LIKE the query won't work correct.

Thanks a lot
-- 
View this message in context: http://n2.nabble.com/problem-bug-with-query-parameters-using-LIKE-operand-tp2177216p2177216.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.