Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] migrating jdbc queries to jpa native queries

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?


Back to the top