我使用的是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。但面临着同样的问题。
任何指向解决方案的指针都会有很大帮助。谢谢。
发布于 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:的
spring:
jpa:
properties:
hibernate:
dialect: org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect
spatial:
connection_finder: it.dedagroup.slim.data.domain.CustomConnectionFinderhttps://stackoverflow.com/questions/52661935
复制相似问题