org.hibernate.MappingException:在非托管实体上没有JDBC类型的Dialect映射:1111

时间:2016-02-09 17:33:28

标签: java hibernate postgresql

我正在从postgres数据库调用一个存储过程,这个SP返回一个表,我在其中映射到一个非托管bean,当我调用REST服务时,它给了我这个例外:' org.hibernate .MappingException:没有JDBC类型的Dialect映射:1111 '。该表没有任何特殊类型的数据,如json或xml,它也不返回间隔。

列clientes最初是bigint,我转换为整数然后转换为varchar。

堆栈跟踪:

10:04:46,406 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111

10:04:46,406 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.dialect.TypeNames.get(TypeNames.java:77)

10:04:46,407 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.dialect.TypeNames.get(TypeNames.java:100)

10:04:46,407 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:378)

10:04:46,407 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:590)

10:04:46,408 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:516)

10:04:46,408 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:532)

10:04:46,408 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.Loader.getResultSet(Loader.java:1962)

10:04:46,409 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.Loader.doQuery(Loader.java:802)

10:04:46,409 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)

10:04:46,409 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.Loader.doList(Loader.java:2542)

10:04:46,410 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)

10:04:46,410 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.Loader.list(Loader.java:2271)

10:04:46,424 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)

10:04:46,424 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)

10:04:46,425 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)

10:04:46,425 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)

10:04:46,425 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at com.ewisemaps.daoImpl.ReporteGasFederalDaoImpl.getReporte(ReporteGasFederalDaoImpl.java:39)

10:04:46,426 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at com.ewisemaps.servicioImpl.ServicioReporteGasFederalImpl.getReporteFederal(ServicioReporteGasFederalImpl.java:26)

10:04:46,426 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at com.ewisemaps.rest.ReporteGasFederalController.getReporteGasFederal(ReporteGasFederalController.java:29)

10:04:46,427 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

10:04:46,427 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

10:04:46,427 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

10:04:46,428 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.lang.reflect.Method.invoke(Method.java:606)

10:04:46,428 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)

10:04:46,428 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)

10:04:46,429 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)

10:04:46,429 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:743)

10:04:46,430 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:672)

10:04:46,430 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:82)

10:04:46,431 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)

10:04:46,431 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)

10:04:46,431 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)

10:04:46,432 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)

10:04:46,432 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

10:04:46,433 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)

10:04:46,433 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

10:04:46,433 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

10:04:46,434 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

10:04:46,434 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:230)

10:04:46,435 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)

10:04:46,435 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

10:04:46,435 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

10:04:46,436 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

10:04:46,436 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

10:04:46,436 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

10:04:46,437 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

10:04:46,437 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

10:04:46,438 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

10:04:46,438 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

10:04:46,438 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

10:04:46,439 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

10:04:46,439 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

10:04:46,439 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.lang.Thread.run(Thread.java:745)

10:04:46,440 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ewisemaps].[appServlet]] (http-localhost-127.0.0.1-8080-2) Servlet.service() para servlet appServlet lanzó excepción: java.lang.NullPointerException
    at com.ewisemaps.servicioImpl.ServicioReporteGasFederalImpl.getReporteFederal(ServicioReporteGasFederalImpl.java:32) [classes:]
    at com.ewisemaps.rest.ReporteGasFederalController.getReporteGasFederal(ReporteGasFederalController.java:29) [classes:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_79]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_79]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_79]
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:743) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:672) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:82) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:230) [spring-orm-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]

商店程序:

 CREATE OR REPLACE FUNCTION report()
      RETURNS TABLE(tipologia varchar  , clientes varchar, saturacion   varchar, distribucion   varchar) AS

    .
    .
    .

SELECT
    nombre as "Tipología",cast(conteo as varchar) as "Número de clientes",
      cast( CONCAT( ROUND(( ( conteo / total ) * 100 ),4),'%')  as varchar )AS    "Saturación de mercado",
       cast(Concat(Round(( Cast(conteo AS DECIMAL) / pobtot ) * 100, 4), '%') as varchar)AS "Distribución clientes nivel federal"

FROM   conteo_parcial

我的java课程:

@Repository
public class ReporteGasFederalDaoImpl implements ReporteGasFederalDao{

    @Autowired
    @Qualifier("sfEwisemaps")
    SessionFactory sf;


    Session session;    

     @SuppressWarnings("unchecked")
    public List<ReporteGasFederal> getReporte()  {

        try{
            Session session = sf.getCurrentSession();

            Query q = session.createSQLQuery("SELECT reporte_gas_federal()");

            q.setResultTransformer(Transformers.aliasToBean(ReporteGasFederal.class));

            List<ReporteGasFederal> results = q.list();


            return results;
        }catch(Exception e){
            e.printStackTrace();
            return null;
        }
    }

}

root-context.xml

<property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.connection.pool_size">5</prop>
                <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory
                </prop>
                <prop key="hibernate.hb2mddl.auto">create</prop>
            </props>
        </property>

0 个答案:

没有答案