How teiid 8.1Final support stored procedure with out parameters?
kchen007 Oct 22, 2012 4:42 PMI am trying to call a stored procedure with OUT parameter from eclipselink, I got the following exceptions:
org.teiid.core.TeiidProcessingException: TEIID30490 Remote org.teiid.api.exception.query.QueryValidatorException: TEIID30490 The query does not return an update count.
at org.teiid.dqp.internal.process.Request.createCommandContext(Request.java:211) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.Request.validateAccess(Request.java:469) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:390) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.PreparedStatementRequest.generatePlan(PreparedStatementRequest.java:155) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.Request.processRequest(Request.java:453) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:532) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:280) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:219) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:249) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:123) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:298) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_32]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_32]
The stored procedure is a simple dummy one, it will take no input parameter, has only one output parameter as Integer, and I just put a number into it, when running from SQL server studio, it would give out value 77.
CREATE PROCEDURE [dbo].[CustOrdersDetail] @OrderID int OUTPUT AS SELECT @OrderID = COUNT(*) FROM PRODUCTS
But If I called the same stored procedure from eclipselink, before it reached the SQL Server, the teiid validataion throws the above exception, the eclipselink code is like this:
StoredProcedureCall spcall = new StoredProcedureCall();
spcall.setProcedureName("CustOrdersDetail");
spcall.addNamedOutputArgument("OrderID", "OrderID", Integer.class);
ValueReadQuery query = new ValueReadQuery();
query.setCall(spcall);
Object orderId = em.getActiveSession().executeQuery(query);
The place that throw the exception is from Request.createCommandContext(), in this case the returnsResultSet=false, returunsUpdateCount=fase becasue the command is StoredProcedure, the ResultsMode is UPDATECOUNT
protected void createCommandContext(Command command) throws QueryValidatorException {
boolean returnsResultSet = command.returnsResultSet();
this.returnsUpdateCount = !(command instanceof StoredProcedure) && !returnsResultSet;
if ((this.requestMsg.getResultsMode() == ResultsMode.UPDATECOUNT && !returnsUpdateCount)
|| (this.requestMsg.getResultsMode() == ResultsMode.RESULTSET && !returnsResultSet)) {
throw new QueryValidatorException(QueryPlugin.Event.TEIID30490
From the 8.1 documentatin it mentions it supports OUT parameters, how can I get it to work with eclipselink?
Thanks.