This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 3775

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: 3775

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipselink problem with MySQL Stored Procedures
 
Similar Threads
Could not insert
Problem using hibernate
Members are not poppulated?
Class calling Class
Error running the application