Skip to content

Conversation

@AntonYudin
Copy link
Contributor

@AntonYudin AntonYudin commented Mar 19, 2018

Changing the createNativeQuery(sql) method to return a List<Object> or List<Object[]>.

According to the JPA 2.1 specification (JSR-338 Final Release, page 75, 4/2/13),
a native query is supposed to return a List<Object> or List<Object[]> and
not a List<Map>

Quote from JPA 2.1 spec:

/**
* Create an instance of Query for executing a native SQL
* statement, e.g., for update or delete.
* If the query is not an update or delete query, query
* execution will result in each row of the SQL result
* being returned as a result of type Object[] (or a result
* of type Object if there is only one column in the select
* list.) Column values are returned in the order of their
* appearance in the select list and default JDBC type
* mappings are applied.
* @param sqlString a native SQL query string
* @return the new query instance
*/
public Query createNativeQuery(String sqlString);

…t<Object[]>.

According to the JPA 2.1 specification (JSR-338 Final Release, page 75, 4/2/13),
a native query is supposed to return a List<Object> or List<Object[]> and not a List<Map>

Quote from JPA 2.1 spec:
/**
* Create an instance of Query for executing a native SQL
* statement, e.g., for update or delete.
* If the query is not an update or delete query, query
* execution will result in each row of the SQL result
* being returned as a result of type Object[] (or a result
* of type Object if there is only one column in the select
* list.) Column values are returned in the order of their
* appearance in the select list and default JDBC type
* mappings are applied.
* @param sqlString a native SQL query string
* @return the new query instance
*/
public Query createNativeQuery(String sqlString);
Copy link
Collaborator

@karthikprasad13 karthikprasad13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, except for the 'XXX" comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants