« Return to Thread: migrating jdbc queries to jpa native queries

Re: migrating jdbc queries to jpa native queries

by ymajoros :: Rate this Message:

Reply to Author | View in Thread

James Sutherland a écrit :
> EclipseLink provides a Query hint that allows the results to be returned as a
> List of Maps (DatabaseRecords) instead of a List of Object[].
>
> "eclipselink.result-type"="Map"
>
> See, org.eclipse.persistence.ResultType , QueryHints
>
>  
So, I guess I need to write this:

        Query query = entityManager.createNativeQuery(sql);
        query.setHint(QueryHints.RESULT_TYPE, ResultType.Map);
        List<Map> results = query.getResultList();
        for (Map result : results) {
         }

What will the result types be? Is everything a String, then?
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

 « Return to Thread: migrating jdbc queries to jpa native queries