aspose file tools*
The moose likes Object Relational Mapping and the fly likes Eclipselink problem with MySQL Stored Procedures Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Eclipselink problem with MySQL Stored Procedures" Watch "Eclipselink problem with MySQL Stored Procedures" New topic
Author

Eclipselink problem with MySQL Stored Procedures

Marc Marais
Greenhorn

Joined: Dec 27, 2011
Posts: 5
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

Joined: Mar 24, 2008
Posts: 3825

Can you post the full stack trace?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Marc Marais
Greenhorn

Joined: Dec 27, 2011
Posts: 5
Thanks for your response. That is the only line of error I have in my console.
Marc Marais
Greenhorn

Joined: Dec 27, 2011
Posts: 5
Here is the full stacktrace:
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3825

Try using executeUpdate() method instead getResultList() method.
Marc Marais
Greenhorn

Joined: Dec 27, 2011
Posts: 5
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

Joined: Oct 01, 2007
Posts: 553
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).

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
 
subject: Eclipselink problem with MySQL Stored Procedures