Hi all

I have a rest WS with CXF and I have implemented the  FIQL
<http://cxf.apache.org/docs/jax-rs-search.html#JAX-RSSearch-BuildingFIQLqueries>
   
along with JPA using EclipseLink.

I am using the JPATypedQueryVisitor to get a TypedQuery and interact with
the database.

FIQL queries work well but I want to find a way to be able to choose which
columns to retrieve from the database. 

For example lets say tha we have a table called "Employee" with the columns
"firstname", "lastname", "age"

with the FIQL ?_s=age==25 i will get back using the TypedQuery<Employee> a
list of Employee objects
with all the attributes, "firstname", "lastname", "age" filled with info.
The sql equivalent would be 
"select * from Employee where age=25"

How can I choose to get back from the database only specific columns e.g.
"firstname"? The asql equivalent 
"select firstname from employee where age=25"


Here is my code

EntityManagerFactory emf = Persistence
                .createEntityManagerFactory("default");
EntityManager em = emf.createEntityManager();
SearchCondition<Employee> sc = searchContext
                .getCondition(Employee.class);
SearchConditionVisitor<Employee, TypedQuery&lt;Employee>> visitor = new
JPATypedQueryVisitor<Employee>(
                em, Employee.class, beanPropertiesMap);
sc.accept(visitor);
TypedQuery<Employee> typedQuery = visitor.getQuery();
typedQuery = typedQuery.setMaxResults(Integer.parseInt(returnNo));
employees.setEmployees(typedQuery.getResultList());

Thanks in advance



--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-select-specific-columns-to-retrieve-with-FIQL-using-JPATypedQueryVisitor-tp5729548.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to