[ 
https://issues.apache.org/jira/browse/OPENJPA-918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674069#action_12674069
 ] 

Craig Russell commented on OPENJPA-918:
---------------------------------------

> However, stored procedures also have the ability to return multiple types of 
> objects in separate ResultSet of data. 

This use case is not covered by the specification. The only cases covered are 
getResultList() and getSingleResult() that expect the query to return a 
ResultSet, and executeUpdate(), that expects an int returned from the query. 

So, getResultList() and getSingleResult() are mapped to a 
Statement.executeQuery(), and executeUpdate() is mapped to executeUpdate().
 
> When trying to get a ResultList(), I use 

> Query query = em.createNativeQuery(sql); 
> List<Applicant> appList = query.getResultList(); 

> and get: 

> Statement.executeQuery() cannot be called with a statement that returns a row 
> count. Odd message since a row count is not being returned, but multiple 
> ResultSets 

Considering that the error description for Statement.executeQuery() says "if a 
database access error occurs; this method is called on a closed 
PreparedStatement or the SQL statement does not return a ResultSet object", the 
error message might better read "Statement.executeQuery() cannot be called with 
a statement that does not return a ResultSet object". 

But in any case, I don't see how to handle a native query that returns multiple 
result sets without changing the specification to deal with it.




> Stored procedures not handling returns properly
> -----------------------------------------------
>
>                 Key: OPENJPA-918
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-918
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: query
>    Affects Versions: 2.0.0
>            Reporter: B.J. Reed
>            Assignee: B.J. Reed
>             Fix For: 2.0.0
>
>         Attachments: OPENJPA-918-test.patch
>
>
> Stored procedures with output parameters are not being handled properly.  
> Patch will be attached shortly with test cases.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to