openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Is this possible with CriteriaBuilder method
Date Tue, 19 Apr 2011 13:19:56 GMT
Hi,
I think the real question is whether your native MySQL query can be
represented with JPQL...  If you can represent this query in the object
space, then it should be doable via either JPQL or the CriteriaBuilder.
Looking at the query below, the only questionable part is the "@rownum" user
variable usage.  The rest of it looks pretty straight forward.

Kevin

On Mon, Apr 18, 2011 at 6:01 AM, chuongpham <chuonglepham@gmail.com> wrote:

> Can I convert this native MySQL query using purely the CriteriaBuilder
> method:
>
> SELECT @rownum:=@rownum+1 'no', m.title, m.author,
> REPLACE(SUBSTRING_INDEX(m.content, ' ', 20), '<br>', ' '), m.viewed,
> m.hashid FROM book m, (SELECT @rownum:=0) r WHERE m.lang = ?1 AND m.title
> like CONCAT('%',?2,'%') ORDER BY m.title asc
>
> I can't find a similar example to reference from the JEE 6 Tutorial
> available at Oracle website.
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Is-this-possible-with-CriteriaBuilder-method-tp6283183p6283183.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message