3 Replies Latest reply on Dec 17, 2015 12:06 PM by shawkins

    Oracle Sequence error: Cannot infer EdmType for java type: oracle.sql.ROWID

    ivan.lucas.vargas

      Hi,

       

      As per the docs (Oracle Translator - Teiid 8.12 - Project Documentation Editor), we can map Oracle sequence as:

       

      "You can also use a sequence as the default value for insert columns by setting the column to autoincrement and the name in source to <element name>:SEQUENCE=<sequence name>.<sequence value>."

       

      So, my mapping is:

      Column Name: TELA_ID

      Name In source: TELA_ID:SEQUENCE=SEQ_TELA.NEXTVAL

      Autoincrement: true

       

      In my odata2 request I'm not sending the TELA_ID field, so by the debug I can confirm that teiid understands correctly the mapping and build the sentence by setting the TELA_ID and the nextval from sequence.

       

      The problem is that, when Teiid tries to retrieve the generated id from the SQL statement, the following error occurs:

       

       

      TEIID16013 Error occurred producing OData result.: java.lang.IllegalArgumentException: Cannot infer EdmType for java type: oracle.sql.ROWID

        at org.odata4j.core.OProperties.simple(OProperties.java:40) [odata-core-0.8.10.jar:0.8.10]

        at org.teiid.odata.ODataSQLBuilder.buildEntityKey(ODataSQLBuilder.java:678) [classes:]

        at org.teiid.odata.TeiidProducer.createEntity(TeiidProducer.java:232) [classes:]

        at org.odata4j.producer.resources.EntitiesRequestResource.createEntity(EntitiesRequestResource.java:129) [odata-core-0.8.10.jar:0.8.10]

        at org.odata4j.producer.resources.EntitiesRequestResource.createEntity(EntitiesRequestResource.java:116) [odata-core-0.8.10.jar:0.8.10]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_45]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_45]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_45]

        at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_45]

        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:168) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:541) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:523) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:125) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at org.teiid.odata.ODataServletContainerDispatcher.service(ODataServletContainerDispatcher.java:118) [classes:]

        at org.teiid.odata.ODataServlet.service(ODataServlet.java:65) [classes:]

        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.9.Final-redhat-7.jar:]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:512) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.5.0.Final-redhat-15.jar:7.5.0.Final-redhat-15]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.5.3.Final.jar:7.5.3.Final]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45]

       

      Am I missing something? As per my understanding, the problem is that Oracle does not return the Column id as metadata (the oracle driver - ojdbc6.jar - returns oracle.sql.ROWID as the column name) and, as consequence, this error occurs.

       

      Please help.

       

      tks