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

The key will be a String of the column name (actually a DatabaseField, but
String works as well).  The value will be Object, or whatever type the
database returns for the column.


ymajoros wrote:
> 
> 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?
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/migrating-jdbc-queries-to-jpa-native-queries-tp24371649p24479678.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top