0 Replies Latest reply on Jul 1, 2008 8:29 AM by Sergey Sedov

    MappingException: JDBC Type -1(MySQL 5)

    Sergey Sedov Newbie

      Hi? I'm using JBOSS-4.2.2, Mysql - 5.0.51a-0. Connector driver - mysql-connector-java-5.1.6.
      When using Native Queries (for example :

      Query query =getEntityManager().createNativeQuery("SELECT agr.AGREEMENTID , enc.NAME\n" +
       "\tFROM GEL$DOC$AGREEMENT agr INNER JOIN GEL$DOC$AGR$ENCLOSURE enc ON (enc.AGREEMENTID = agr.AGREEMENTID)\n" +
       "UNION\n" +
       "SELECT template.TEMPLATEID, tenc.NAME\n" +
       "\tFROM GEL$DOC$TEMPLATE template INNER JOIN GEL$DOC$TPL$PARAGRAPH tenc ON (tenc.TEMPLATEID = template.TEMPLATEID)") ;
      
       List<Object[]> obj = query.getResultList() ;
      )

      I get an error:

      15:54:53,509 ERROR [STDERR] javax.ejb.EJBException: javax.persistence.Persistenc eException: org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
      15:54:53,510 ERROR [STDERR] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptio nInOurTx(Ejb3TxPolicy.java:63)
      15:54:53,510 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(T xPolicy.java:83)
      15:54:53,510 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.i nvoke(TxInterceptor.java:191)
      15:54:53,510 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,510 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor .invoke(TxPropagationInterceptor.java:95)
      15:54:53,510 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,510 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInt erceptor.invoke(StatelessInstanceInterceptor.java:62)
      15:54:53,511 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,511 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInte rceptor.invoke(AuthenticationInterceptor.java:77)
      15:54:53,511 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInt erceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      15:54:53,511 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,511 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invo ke(ENCPropagationInterceptor.java:46)
      15:54:53,511 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,511 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInter ceptor.invoke(AsynchronousInterceptor.java:106)
      15:54:53,511 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,511 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.l ocalInvoke(StatelessContainer.java:240)
      15:54:53,511 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.l ocalInvoke(StatelessContainer.java:210)
      15:54:53,511 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy. invoke(StatelessLocalProxy.java:84)
      15:54:53,511 ERROR [STDERR] at $Proxy314.store(Unknown Source)
      15:54:53,511 ERROR [STDERR] at ru.geckoSoftware.geleos.documents.faces.agree ment.AgreementInfo.store(Unknown Source)
      15:54:53,511 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method)
      15:54:53,512 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N ativeMethodAccessorImpl.java:39)
      15:54:53,512 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo ke(DelegatingMethodAccessorImpl.java:25)
      15:54:53,512 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:5 85)
      15:54:53,512 ERROR [STDERR] at org.apache.myfaces.el.MethodBindingImpl.invok e(MethodBindingImpl.java:129)
      15:54:53,512 ERROR [STDERR] at org.apache.myfaces.application.ActionListener Impl.processAction(ActionListenerImpl.java:63)
      15:54:53,512 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UIC ommand.java:106)
      15:54:53,512 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processEv ents(AjaxViewRoot.java:184)
      15:54:53,512 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.broadcast Events(AjaxViewRoot.java:162)
      15:54:53,512 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processAp plication(AjaxViewRoot.java:350)
      15:54:53,512 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.in vokeApplication(LifecycleImpl.java:343)
      15:54:53,512 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.ex ecute(LifecycleImpl.java:86)
      15:54:53,512 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(Faces Servlet.java:137)
      15:54:53,512 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.internalDoFilter(ApplicationFilterChain.java:290)
      15:54:53,512 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.doFilter(ApplicationFilterChain.java:206)
      15:54:53,513 ERROR [STDERR] at org.apache.myfaces.webapp.filter.ExtensionsFi lter.doFilter(ExtensionsFilter.java:100)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.internalDoFilter(ApplicationFilterChain.java:235)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.doFilter(ApplicationFilterChain.java:206)
      15:54:53,513 ERROR [STDERR] at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter (BaseXMLFilter.java:141)
      15:54:53,513 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseF ilter.java:281)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.internalDoFilter(ApplicationFilterChain.java:235)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.doFilter(ApplicationFilterChain.java:206)
      15:54:53,513 ERROR [STDERR] at org.apache.myfaces.webapp.filter.ExtensionsFi lter.doFilter(ExtensionsFilter.java:147)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.internalDoFilter(ApplicationFilterChain.java:235)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.doFilter(ApplicationFilterChain.java:206)
      15:54:53,513 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilte r.doFilter(ReplyHeaderFilter.java:96)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.internalDoFilter(ApplicationFilterChain.java:235)
      15:54:53,513 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.doFilter(ApplicationFilterChain.java:206)
      15:54:53,514 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve .invoke(StandardWrapperValve.java:230)
      15:54:53,514 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve .invoke(StandardContextValve.java:175)
      15:54:53,514 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssocia tionValve.invoke(SecurityAssociationValve.java:179)
      15:54:53,514 ERROR [STDERR] at org.apache.catalina.authenticator.Authenticat orBase.invoke(AuthenticatorBase.java:524)
      15:54:53,514 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValv e.invoke(JaccContextValve.java:84)
      15:54:53,514 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.in voke(StandardHostValve.java:127)
      15:54:53,514 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.i nvoke(ErrorReportValve.java:102)
      15:54:53,514 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnec tionValve.invoke(CachedConnectionValve.java:157)
      15:54:53,514 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve. invoke(StandardEngineValve.java:109)
      15:54:53,514 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.s ervice(CoyoteAdapter.java:262)
      15:54:53,514 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.proc ess(Http11Processor.java:844)
      15:54:53,514 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http1 1ConnectionHandler.process(Http11Protocol.java:583)
      15:54:53,514 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker .run(JIoEndpoint.java:446)
      15:54:53,515 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
      15:54:53,515 ERROR [STDERR] Caused by: javax.persistence.PersistenceException: o rg.hibernate.MappingException: No Dialect mapping for JDBC type: -1
      15:54:53,515 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.t hrowPersistenceException(AbstractEntityManagerImpl.java:629)
      15:54:53,515 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.getResultList(Que ryImpl.java:73)
      15:54:53,515 ERROR [STDERR] at ru.geckoSoftware.geleos.service.documents.agr eement.AgreementServiceImpl.store(Unknown Source)
      15:54:53,516 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method)
      15:54:53,516 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N ativeMethodAccessorImpl.java:39)
      15:54:53,516 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo ke(DelegatingMethodAccessorImpl.java:25)
      15:54:53,516 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:5 85)
      15:54:53,516 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:112)
      15:54:53,516 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextI mpl.proceed(InvocationContextImpl.java:166)
      15:54:53,516 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsIn terceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      15:54:53,516 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,516 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntity ManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      15:54:53,516 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,516 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.i nvoke(AllowedOperationsInterceptor.java:47)
      15:54:53,516 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo keNext(MethodInvocation.java:101)
      15:54:53,516 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(T xPolicy.java:79)
      15:54:53,517 ERROR [STDERR] ... 60 more
      15:54:53,517 ERROR [STDERR] Caused by: org.hibernate.MappingException: No Dialec t mapping for JDBC type: -1
      15:54:53,517 ERROR [STDERR] at org.hibernate.dialect.TypeNames.get(TypeNames .java:56)
      15:54:53,518 ERROR [STDERR] at org.hibernate.dialect.TypeNames.get(TypeNames .java:81)
      15:54:53,518 ERROR [STDERR] at org.hibernate.dialect.Dialect.getHibernateTyp eName(Dialect.java:370)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.custom.CustomLoader$Meta data.getHibernateType(CustomLoader.java:559)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.custom.CustomLoader$Scal arResultColumnProcessor.performDiscovery(CustomLoader.java:485)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.custom.CustomLoader.auto DiscoverTypes(CustomLoader.java:501)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.Loader.getResultSet(Load er.java:1796)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.Loader.doQuery(Loader.ja va:674)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.Loader.doQueryAndInitial izeNonLazyCollections(Loader.java:236)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.Loader.doList(Loader.jav a:2220)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.Loader.listIgnoreQueryCa che(Loader.java:2104)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.Loader.list(Loader.java: 2099)
      15:54:53,518 ERROR [STDERR] at org.hibernate.loader.custom.CustomLoader.list (CustomLoader.java:289)
      15:54:53,518 ERROR [STDERR] at org.hibernate.impl.SessionImpl.listCustomQuer y(SessionImpl.java:1695)
      15:54:53,518 ERROR [STDERR] at org.hibernate.impl.AbstractSessionImpl.list(A bstractSessionImpl.java:142)
      15:54:53,519 ERROR [STDERR] at org.hibernate.impl.SQLQueryImpl.list(SQLQuery Impl.java:152)
      15:54:53,519 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.getResultList(Que ryImpl.java:64)
      15:54:53,519 ERROR [STDERR] ... 74 more
      


      Here is my persistence.xml :
      <persistence>
       <persistence-unit name="GP">
       <jta-data-source>java:/GPDS</jta-data-source>
       <properties>
                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                  <property name="hibernate.hbm2ddl.auto" value=""/>
                  <property name="hibernate.show_sql" value="false" />
                  <property name="hibernate.use_outer_join" value="true" />
                  <property name="hibernate.max_fetch_depth" value="0" />
       <property name="com.intellij.javaee.persistence.datasource" value="252"/>
       <!--<property name="connection.url">jdbc:mysql://195.34.12.76:3306/geleos</property> <property name="connection.username">geleos</property>-->
       <!--<property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.password">geleos</property>-->
       </properties>
       </persistence-unit>
      </persistence>
      


      And application-ds.xml
      <datasources>
       <local-tx-datasource>
            <jndi-name>GPDS</jndi-name>
              <connection-url>jdbc:mysql://192.168.0.251:3306/geleos?zeroDateTimeBehavior=convertToNull</connection-url>
              <driver-class>com.mysql.jdbc.Driver</driver-class>
              <user-name>user</user-name>
              <password>pswd</password>
              <connection-property name="autoReconnect">true</connection-property>
              <connection-property name="autoReconnectForPools">true</connection-property>       
             
       <!--<metadata>-->
      <!--            <type-mapping>mySQL</type-mapping>-->
      <!--        </metadata>-->
       
              <min-pool-size>5</min-pool-size>
       
              <max-pool-size>30</max-pool-size>
       
              <idle-timeout-minutes>30</idle-timeout-minutes>
             
       <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
             
              <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name> </local-tx-datasource>
      </datasources>


      When using non native queries everithing is ok.