Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Class cast exception calling oracle storedprocedure by @NamedStoredProcedureQuery

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="YETAXAPP.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(YeAssetsDAO.java:141)
	at
com.mgl.yearendtax.userinterface.application.handlers.RefreshUnitsHeld.execute(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(ParameterizedCommand.java:508)
	at
org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at
org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)
	at
org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)
	at
org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:619)
	at
org.eclipse.ui.menus.CommandContributionItem.access$10(CommandContributionItem.java:605)
	at
org.eclipse.ui.menus.CommandContributionItem$4.handleEvent(CommandContributionItem.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:488)
	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.java:193)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.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.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.

-- 
View this message in context: http://www.nabble.com/Class-cast-exception-calling-oracle-storedprocedure-by-%40NamedStoredProcedureQuery-tp21823222p21823222.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top