Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] Class cast exception calling oraclestoredprocedure by @NamedStoredProcedureQuery

Hi James,

That is the only stack trace I get? I've already tried using
executeUpdate() and I get the following output:

!ENTRY org.eclipse.ui 4 0 2009-02-05 08:49:21.836
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.RuntimeException: You cannot call executeUpdate() on this
query.  It is the incorrect query type.
	at
com.mgl.yearendtax.datamodel.dao.impl.YeAssetsDAO.refreshUnitsHeld(YeAss
etsDAO.java:142)
	at
com.mgl.yearendtax.userinterface.application.handlers.RefreshUnitsHeld.e
xecute(RefreshUnitsHeld.java:16)
	at
org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:
281)
	at
org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at
org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(Paramet
erizedCommand.java:508)
	at
org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerSe
rvice.java:169)
	at
org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(Slav
eHandlerService.java:247)
	at
org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(Slav
eHandlerService.java:247)
	at
org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(Comma
ndContributionItem.java:619)
	at
org.eclipse.ui.menus.CommandContributionItem.access$10(CommandContributi
onItem.java:605)
	at
org.eclipse.ui.menus.CommandContributionItem$4.handleEvent(CommandContri
butionItem.java:595)
	at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
	at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
	at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
	at
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
	at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:
288)
	at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:4
88)
	at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at com.mgl.bfs.desktop.Application.start(Application.java:169)
	at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.j
ava:193)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplicat
ion(EclipseAppLauncher.java:110)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Eclip
seAppLauncher.java:79)
	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
386)
	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)

You saying that there was no eclipselink output got me thinking. I've
set my environment up with JPA using the eclipselink tutorial at:
http://wiki.eclipse.org/EclipseLink/Examples/JPA/RCP

Is there something I should include to get the eclipselink stack or is
this JPA making use of eclipselink (making it a JPA issue rather than
eclipselink and therefore making this the wrong forum)?

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of James
Sutherland
Sent: Thursday, 5 February 2009 12:37 AM
To: eclipselink-users@xxxxxxxxxxx
Subject: Re: [eclipselink-users] Class cast exception calling
oraclestoredprocedure by @NamedStoredProcedureQuery


Could you include the full exception stack trace, EclipseLink is not on
the stack you provided.

If the procedure does not return anything, you should execute it with
executeUpdate().


sapatos wrote:
> 
> Hi,
> 
> I'm using eclipselink with JPA and am trying to call a simple no 
> parameter oracle stored procedure using @NamedStoredProcedureQuery. It

> appears to be running as the application hangs (i've not stuck it in a

> separate thread
> yet) and then it throws a:
> 
> java.lang.RuntimeException: oracle.jdbc.driver.OraclePreparedStatement
> cannot be cast to java.sql.CallableStatement
> 
> The @NamedStoredProcedureQuery is declared on the entity as:
> 
> @NamedStoredProcedureQuery(name="refreshUnitsHeld",procedureName="YETA
> XAPP.REFRESH_UNITS_HELD",resultClass=void.class,returnsResultSet
> = false)
> 
> (I get the same errors with or without 
> "resultClass=void.class,returnsResultSet = false")
> 
> I call this from the DAO as:
> 
> 	@Override
> 	public void refreshUnitsHeld() {
> 
> 		Query query = em.createNamedQuery("refreshUnitsHeld");
> 
> 		em.getTransaction().begin();
> 		try {
> 			query.getResultList();
> 			em.getTransaction().commit();
> 		} catch (Exception e) {
> 			em.getTransaction().rollback();
> 			throw new RuntimeException(e.getMessage());
> 		}
> 
> 	}
> 
> It has no return values. the full stack trace is:
> 
> [EL Fine]: 2009.02.04 10:47:01.555--Connection(26237506)--BEGIN
> YETAXAPP.REFRESH_UNITS_HELD(); END;
> [EL Warning]: 2009.02.04 10:47:17.337--java.lang.ClassCastException:
> oracle.jdbc.driver.OraclePreparedStatement cannot be cast to 
> java.sql.CallableStatement
> 
> !ENTRY org.eclipse.ui 4 0 2009-02-04 10:47:17.368 !MESSAGE Unhandled 
> event loop exception !STACK 0
> java.lang.RuntimeException: oracle.jdbc.driver.OraclePreparedStatement
> cannot be cast to java.sql.CallableStatement
> 	at
>
com.mgl.yearendtax.datamodel.dao.impl.YeAssetsDAO.refreshUnitsHeld(YeAss
etsDAO.java:141)
> 	at
>
com.mgl.yearendtax.userinterface.application.handlers.RefreshUnitsHeld.e
xecute(RefreshUnitsHeld.java:16)
> 	at
>
org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:
281)
> 	at
org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
> 	at
>
org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(Paramet
erizedCommand.java:508)
> 	at
>
org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerSe
rvice.java:169)
> 	at
>
org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(Slav
eHandlerService.java:247)
> 	at
>
org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(Slav
eHandlerService.java:247)
> 	at
>
org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(Comma
ndContributionItem.java:619)
> 	at
>
org.eclipse.ui.menus.CommandContributionItem.access$10(CommandContributi
onItem.java:605)
> 	at
>
org.eclipse.ui.menus.CommandContributionItem$4.handleEvent(CommandContri
butionItem.java:595)
> 	at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> 	at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
> 	at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
> 	at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
> 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
> 	at
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
> 	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> 	at
>
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:
288)
> 	at
>
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:4
88)
> 	at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> 	at com.mgl.bfs.desktop.Application.start(Application.java:169)
> 	at
>
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.j
ava:193)
> 	at
>
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplicat
ion(EclipseAppLauncher.java:110)
> 	at
>
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Eclip
seAppLauncher.java:79)
> 	at
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
386)
> 	at
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
179)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
> 	at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> 
> I can't find anything on the web about this error message.
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James
Sutherland http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context:
http://www.nabble.com/Class-cast-exception-calling-oracle-storedprocedur
e-by-%40NamedStoredProcedureQuery-tp21823222p21830613.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

NOTICE
This e-mail and any attachments are confidential and may contain copyright material of Macquarie Group Limited or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Group Limited does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Group Limited.



Back to the top