Is it possible to use dbcp with hibernatespatial and oracle?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to use dbcp with hibernatespatial and oracle?

sarah@frenchfrieswithpepper.co
I am attempting to use hibernatespatial to configure a simple point
geometry column for management by hibernate.

However, the org.hibernatespatial.oracle.DefaultConnectionFinder is
unable to obtain the oracle connection.  I receive the error:
"Couldn't get at the OracleSpatial Connection object from the
PreparedStatement."

Is there a requirement to use c3p0 with hibernate spatial?  I've been
using dbcp for several years without any issues and I'm reluctant to
switch.

Here is some of my configuration...

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.user}"/>
        <property name="password" value="${jdbc.password}"/>
        <property name="validationQuery" value="select 1 from dual"/>
    </bean>

    <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation">
            <value>classpath:hibernate.cfg.xml</value>
        </property>
        <property  name="configurationClass">
            <value>org.hibernate.cfg.AnnotationConfiguration</value>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.bytecode.provider">javassist</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.hbm2ddl.auto">validate</prop>
                <prop
key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <prop
key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.use_query_cache">false</prop>
                <prop
key="hibernate.dialect">gov.nyc.doitt.gis.webmap.dao.hibernate.OracleSpatialDialect</prop>
            </props>
        </property>
    </bean>
        <bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

gov.nyc.doitt.gis.webmap.dao.hibernate.OracleSpatialDialect is just a
simple extension of
org.hibernatespatial.oracle.OracleSpatial10gDialect that I created as
a workaround...

public class OracleSpatialDialect extends OracleSpatial10gDialect {
        private static final long serialVersionUID = 1108L;

        public OracleSpatialDialect() {
        super();
        registerColumnType(java.sql.Types.STRUCT, "SDO_GEOMETRY"); //
instead of MDSYS.SDO_GEOMETRY which didn't match my table metadata
    }
}
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users