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

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


ymajoros wrote:
> 
>  Hi,
> 
>  Is there a simple way to migrate code like this to jpa/eclipselink?
> 
> // get connection, statement
>  ResultSet rs = statement.executeQuery(maCommande);
>   while (rs.next()) {
>                     String code = rs.getString("code_etude");
>    // ...
>   }
> 
>  In order to use jpa-provided connection pools, to have all statements 
> closed in all cases without try-finally blocks, ...
> 
>  Is there a simple solution? Native queries return an array with unnamed 
> columns, we really want to use methods like 
> rs.getString("my_column_name"). We can't use SqlResultSetMapping, as the 
> queries are too complex to be mapped.
> 
>  Yannick
> 
> 


-----
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-tp24371649p24374654.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top