Skip to main content

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

  • From: Steve Ebersole <steve.ebersole@...>
  • To: jsr338-experts@...
  • Subject: [jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification
  • Date: Fri, 02 Aug 2013 18:45:51 -0500
  • List-id: <jsr338-experts.jpa-spec.java.net>

Not that anyone was jumping up and down to answer... :)

But I found the cause of my confusion. It was yet another bad TCK assertion with regards to hasMoreResults(). I have opened yet another challenge for that.


On Fri 26 Jul 2013 05:39:04 PM CDT, Steve Ebersole wrote:
And they just keep coming :)

EntityManager em = ...;
StoredProcedureQuery query = em.createStoredProcedureQuery(...);
boolean isResults = query.execute();
// this result is an update count...
assertFalse( isResults );
// but lets try to deal with it as a results
List list = query.getResultList();


Neither the spec nor the javadocs for getResultList() directly deals
with this case.  Unless we can interpret "@throws
IllegalStateException if called for a Java Persistence query language
UPDATE or DELETE statement" to more broadly apply to any of the nested
results.  Is that the intent?


On Fri 26 Jul 2013 05:26:42 PM CDT, Steve Ebersole wrote:
Related:

EntityManager em = ...;
StoredProcedureQuery query = em.createStoredProcedureQuery(...);
query.getUpdateCount();
query.getUpdateCount();
query.getUpdateCount();
...

Even say it "does the right thing":
StoredProcedureQuery query = em.createStoredProcedureQuery(...);
query.execute();
query.getUpdateCount();
query.getUpdateCount();
query.getUpdateCount();

Javadoc for getUpdateCount says "Return the update count or -1 if
there is no pending result or if the next result is not an update
count."

The part that bothers me is the "next result" bit.  To me that
indicates that we are supposed to "move on" to the next result.  But
say the next logical result is a ResultSet.  I guess I am not seeing
the consistent way to cycle through the ResultSets/updateCounts if the
TCK tests are how this is supposed to work.  All these situations are
exactly things done in the TCK.


On Fri 26 Jul 2013 05:16:44 PM CDT, Steve Ebersole wrote:
EntityManager em = ...;
StoredProcedureQuery query = em.createStoredProcedureQuery(...);
query.getUpdateCount();

What should happen above when getUpdateCount() is called?  The
"result" corollaries (getResultList, getSingleResult) specifically say
that the query will be executed when they are called. getUpdateCount
conspicuously says nothing on the subject.  Nor does it call out being
allowed to throw an exception in this case.  So should I assume that
getUpdateCount() should just return -1 here?

Yes, its a silly case, but the TCK does it.  Many times...




[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

Steve Ebersole 08/02/2013

<Possible follow-up(s)>

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

gordon yorke 08/06/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

Linda DeMichiel 08/06/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

Kevin Sutter 08/06/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

Linda DeMichiel 08/06/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

Kevin Sutter 08/06/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

Steve Ebersole 08/12/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

Linda DeMichiel 08/06/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

gordon yorke 08/06/2013

[jpa-spec users] [jsr338-experts] Re: StoredProcedure clarification

gordon yorke 08/06/2013
 
 
Close
loading
Please Confirm
Close