- This topic has 1 reply, 2 voices, and was last updated 15 years, 1 month ago by Loyal Water.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
andres1981MemberHi, i’m using JPA + oracle 10g + websphere 6.1
i’m trying to implement a @NamedStoredProcedureQuery annotation to call a stored procedure in my DB
Here’s the code of the SP
CREATE OR REPLACE PROCEDURE PORTAL.TEST (VALUEX IN NUMBER) AS VAR1 NUMBER; BEGIN SELECT VALUEX INTO VAR1 FROM DUAL; END TEST; /
The SP doesn’t return any value, i’m just trying to get access into with my entity manager
Here’s the code of the @NamedStoredProcedureQuery annotation in my entity
@NamedStoredProcedureQueries( @NamedStoredProcedureQuery(name="SP_TEST", procedureName="PORTAL.TEST", parameters={ @StoredProcedureParameter(name="VALUEX", queryParameter="VALUEX", type=int.class, direction=Direction.IN) }, resultClass= void.class, returnsResultSet = false ) )
Now this is the code for calling the store procedure with an em
Query query; query = entityManager.createNamedQuery("SP_TEST") .setParameter("VALUEX", numeroArea); query.getSingleResult();
And i got the following exception:
exception:java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement incompatible with java.sql.CallableStatement at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.executeStoredProcedure(DatabasePlatform.java:1681) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:567) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:500) at org.eclipse.persistence.internal.sessions.AbstractSession.executeCall(AbstractSession.java:855) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:204) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:190) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:261) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:243) at org.eclipse.persistence.queries.ResultSetMappingQuery.executeDatabaseQuery(ResultSetMappingQuery.java:203) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:666) at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:585) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2587) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1178) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1162) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1136) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1118) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:399) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:547) at mx.com.afirme.midas.catalogos.zonacresta.ZonaCrestaFacade.obtieneIdZonaCresta(ZonaCrestaFacade.java:197) at mx.com.afirme.midas.catalogos.zonacresta.EJSRemote0SLZonaCrestaFacade_3b7d5a3c.obtieneIdZonaCresta(EJSRemote0SLZonaCrestaFacade_3b7d5a3c.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at com.ibm.rmi.util.ProxyUtil$4.run(ProxyUtil.java:726) at java.security.AccessController.doPrivileged(AccessController.java:246) at com.ibm.rmi.util.ProxyUtil.invokeWithClassLoaders(ProxyUtil.java:724) at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1160) at $Proxy35.obtieneIdZonaCresta(Unknown Source) at mx.com.afirme.midas.catalogos.zonacresta._ZonaCrestaFacadeRemote_Stub.obtieneIdZonaCresta(_ZonaCrestaFacadeRemote_Stub.java) at mx.com.afirme.midas.catalogos.zonacresta.ZonaCrestaSN.obtieneIdZonaCresta(ZonaCrestaSN.java:201) at mx.com.afirme.midas.catalogos.zonacresta.ZonaCrestaDN.obtieneIdZonaCresta(ZonaCrestaDN.java:114) at mx.com.afirme.midas.catalogos.zonacresta.ZonaCrestaAction.listar(ZonaCrestaAction.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170) at org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:166) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1151) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1086) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145) at mx.com.afirme.midas.sistema.seguridad.Filtro.doFilter(Filtro.java:117) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:834) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:682) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:588) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:489) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3453) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
am i missing something? Any help would be appreciated
Regards
Andres1981
Loyal WaterMemberAndres1981,
I’m afraid I dont have any tips for you. The other users on the forums would be able to help you out with this. -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)