You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by ram <ra...@yahoo.co.in> on 2016/02/15 22:12:46 UTC
passing select column list as string
Hello,
i was trying to write a namedquery , but would like to pass the select columns as arguments .
@NamedQuery(name="emp.findAll", query="SELECT s.id.name,s.id.phone,s.address FROM emp where s.id.name=:na and s.id.phone=:ph").
I would like to pass "s.id.name,s.id.phone,s.address " it as string instead of entity.column.
@NamedQuery(name="emp.findAll", query="SELECT ?string FROM emp where s.id.name=:na and s.id.phone=:ph").
can i do this if so how can i pass this ?string
--Thanks
Re: passing select column list as string
Posted by ram <ra...@yahoo.co.in>.
Thanks Roberto, i will try using Criteria api.
On Tuesday, 16 February 2016 3:25 PM, Roberto Cortez <ra...@yahoo.com.INVALID> wrote:
Hi ram,
As far as i know, is not possible to set the select columns as parameters.
If you want to make it dynamic, you can try the Criteria API.
Cheers,Roberto
From: ram <ra...@yahoo.co.in>
To: "users@openjpa.apache.org" <us...@openjpa.apache.org>
Sent: Monday, February 15, 2016 1:12 PM
Subject: passing select column list as string
Hello,
i was trying to write a namedquery , but would like to pass the select columns as arguments .
@NamedQuery(name="emp.findAll", query="SELECT s.id.name,s.id.phone,s.address FROM emp where s.id.name=:na and s.id.phone=:ph").
I would like to pass "s.id.name,s.id.phone,s.address " it as string instead of entity.column.
@NamedQuery(name="emp.findAll", query="SELECT ?string FROM emp where s.id.name=:na and s.id.phone=:ph").
can i do this if so how can i pass this ?string
--Thanks
Re: passing select column list as string
Posted by Roberto Cortez <ra...@yahoo.com.INVALID>.
Hi ram,
As far as i know, is not possible to set the select columns as parameters.
If you want to make it dynamic, you can try the Criteria API.
Cheers,Roberto
From: ram <ra...@yahoo.co.in>
To: "users@openjpa.apache.org" <us...@openjpa.apache.org>
Sent: Monday, February 15, 2016 1:12 PM
Subject: passing select column list as string
Hello,
i was trying to write a namedquery , but would like to pass the select columns as arguments .
@NamedQuery(name="emp.findAll", query="SELECT s.id.name,s.id.phone,s.address FROM emp where s.id.name=:na and s.id.phone=:ph").
I would like to pass "s.id.name,s.id.phone,s.address " it as string instead of entity.column.
@NamedQuery(name="emp.findAll", query="SELECT ?string FROM emp where s.id.name=:na and s.id.phone=:ph").
can i do this if so how can i pass this ?string
--Thanks