Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipselink problem with MySQL Stored Procedures

 
Marc Marais
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.

I am trying to set up Eclipselink to work with my MySQL database, in particular the stored procedures. Below is my code:

User.java


LoginAction.java


Stored Procedure


When I attempt to get the result list I get the following error:


Does anyone know how I can cast the statement or if there is a problem with my code or a workaround?
 
Vijitha Kumara
Bartender
Pie
Posts: 3918
10
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the full stack trace?
 
Marc Marais
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response. That is the only line of error I have in my console.
 
Marc Marais
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the full stacktrace:
 
Vijitha Kumara
Bartender
Pie
Posts: 3918
10
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using executeUpdate() method instead getResultList() method.
 
Marc Marais
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought executeUpdate() was used to run update and delete statements. It returns an integer and I need a result class.
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue is that your procedure returns a result set, but by default @NamedStoredProcedureQuery assumes output parameters are used or no result.

You need to set returnsResultSet=true in your @NamedStoredProcedureQuery.

But please log a bug, this exception should not occur, it should always be using a CallableStatement for @NamedStoredProcedureQuery, (but you should get an empty result set without returnsResultSet=true).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic