resulttransformer « SQL « JPA Q&A

1. Hibernate ResultTransformer with addEntity - what's the correct syntax?

Consider the following query:

"SELECT a.code as code,{locFrom.*} " +
"FROM audit.auditlogrecord a " +
"LEFT OUTER JOIN iwrs.location locFrom on "
I want to map the result to this class:
public class MovementHistoryImpl implements ...

2. [SOLVED] Native SQL and resulttransformer problem

In our company we have a framework for paging. In a request object you pass page size, current page, filter and ordering,... and the query and in a response object you get the result as a List. The queries can be HQL as string, DetachedCriteria or native SQL as string. Until now the requirement for the queries was that they returned ...

3. ResultTransformer with SQL

List cachedResultList = new ArrayList(); Query qry = getSession().createQuery("select a as a, b as b, c as c from Some") qry.setResultTransformer(Transformers.aliasToBean(SomeDTO.class)); ScrollableResults scrollableResults = query.scroll(); scrollableResults.first(); scrollableResults.scroll(5); while ( { Object[] rowObjects = scrollableResults.get(); SomeDTO transformedDTO = (SomeDTO)rowObjects[0]; // [b]rowObjects.size() = 1[/b] ...