Search code examples
hibernateweblogic12chibernate-spatial

Unable to get Connection while using Hibernate Spatial


We are using Weblogic, Hibernate 4.2.7, Hibernate Spatial 4.0 and Oracle as Database.

Upon Performing Save operation some times we are observing Unable to get Connection

Can you suggest any configuration we missed for Spatial ?

    Stack Trace :
    Caused by: org.hibernate.spatial.helper.FinderException: Tried retrieving OracleConnection from weblogic.jdbc.wrapper.JTSConnection_weblogic_jdbc_wrapper_PooledConnection_oracle_jdbc_driver_LogicalConnection using method getConnectionCacheCallbackPrivObj, but received null.
    at org.hibernate.spatial.dialect.oracle.DefaultConnectionFinder.find(DefaultConnectionFinder.java:75)
    at org.hibernate.spatial.dialect.oracle.DefaultConnectionFinder.find(DefaultConnectionFinder.java:44)
    at org.hibernate.spatial.dialect.oracle.OracleJDBCTypeFactory.createStruct(OracleJDBCTypeFactory.java:119)
    ... 79 more

Solution

  • Hibernate Spatial for Oracle DB requires the native oracle connection (take a look to documentation section The ConnectionFinder Interface). You must adjust weblogic configuration or implement your own ConnectionFinder to provide the Oracle connetion to Hib-Spa.

    By example, if you were using use DBCP connection poll you just need set accessToUnderlyingConnectionAllowed property to true.

    Good luck!