首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring Boot -无法从PreparedStatement获取OracleSpatial连接对象

Spring Boot -无法从PreparedStatement获取OracleSpatial连接对象
EN

Stack Overflow用户
提问于 2018-10-05 16:59:53
回答 1查看 489关注 0票数 1

我使用的是Spring Boot 2.0.1、hibernate-spatial 5.2.17、Oracle DB 12c。连接池的HikariCP和OracleSpatial10gDialect的hibernate方言。当我的查询中使用hibernate空间函数时,我得到了以下异常。

org.springframework.orm.jpa.JpaSystemException: java.lang.RuntimeException:无法从PreparedStatement获取OracleSpatial连接对象;嵌套异常是org.hibernate.HibernateException: java.lang.RuntimeException:无法从PreparedStatement获取OracleSpatial连接对象。

我尝试了这里的建议,Couldn't get at the OracleSpatial Connection object from the PreparedStatement。但面临着同样的问题。

任何指向解决方案的指针都会有很大帮助。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2020-03-26 00:20:04

来自hibernate文档:https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html

ConnectionFinder接口1:https://i.stack.imgur.com/5by4Q.png

我解决了这个问题:

实现接口org.geolatte.geom.codec.db.oracle.ConnectionFinder;的

公共类CustomConnectionFinder实现了ConnectionFinder { @SneakyThrows @Override public Connection find(Connection connection) { return ((HikariProxyConnection) connection).unwrap(OracleConnection.class);} }

配置application.yml:的

代码语言:javascript
复制
    spring:
      jpa:
        properties:
          hibernate:
            dialect: org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect
            spatial:
              connection_finder: it.dedagroup.slim.data.domain.CustomConnectionFinder
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52661935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档