With recursive query to load browse screen data

Hi,

I was trying to load data on browse screen by using jpql query and collectionLoader.load()
but since jpql does not support jpql, i tried jdbc template to load data by using recursive query.

and i set the data in collectioncontainer.setitems(data) and added in collectionloader i was able to view required data but when i tries to use browse screen filters to serach any data i get below exceptions

 java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Syntax error parsing
[34, 54] The named input parameter ''{0}'' is not following the rules for a Java identifier.

Kindly suggest if there is any other way to view jdbctemplate data on browse screen and also would able to use filters to search data.

Any Solution for this ?

The generic filter component creates a set of conditions that are interpreted by JpaDataStore and transformed to the JPQL conditions. So generic filter works out-of-the-box only if DataLoader contains a JPQL query.

Create loadDelegate for your loader and use JdbcTemplate to load data and map to entities. You don’t need to set items to collection container in this case. The generic filter conditions will be passed to your load delegate in loadContext.getQuery().getCondition() - you can transform them to the SQL conditions.

Hi,

loadContext.getQuery().getCondition()` - you can transform them to the SQL conditions.

Should i use PropertyCondition to fetch every parameterss and passes to sql or queries or there is some other way to create query from filter.

Yes you should analyze the tree of conditions and create appropriate SQL clauses.