Progress and Hibernate

avine

New Member
Has anyone attempted to get Progress working with the Hibernate ORM?
If so, what has been your experience?


Thanks
Andrew
 
Here's a config

Getting the driver loaded on Linux was something that I had success with some years ago on Mandrake, by grabbing a couple libs from a RedHat distro, but that was pre-hibernate.

It's a bit easier to get running on windows, and I've just succeeded with Windows XP.

Once you get the JDBC driver working properly (you'll need to set the classpaths right, and the Client Networking install is critical), it IS possible to get Hibernate working....Note that it's version 9.1D.

Here's a spring/hibernate config that worked for me...
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName">
            <value>com.progress.sql.jdbc.JdbcProgressDriver</value>
        </property>
        <property name="url">
            <value>jdbc:jdbcprogress:T:your-db-machine:your-db-port:your-db-name;</value>
        </property>
        <property name="username">
            <value>blahblah</value>
        </property>
        <property name="password">
            <value>blahblah</value>
        </property>
        
    </bean>
    
    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref local="dataSource"/>
        </property>
        <property name="mappingResources">
            <list>
                <value>your/class/package/Mapping.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">net.sf.hibernate.dialect.ProgressDialect</prop>
                <prop key="hibernate.connection.driver_class">com.progress.sql.jdbc.JdbcProgressDriver</prop>
                <prop key="hibernate.connection.url">jdbc:jdbcprogress:T:your-db-machine:your-db-port:your-db-name;</prop>
                <prop key="hibernate.connection.username">sysprogress</prop>
                <prop key="hibernate.connection.password">password</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.query.substitutions">Y</prop>
            </props>
        </property>
    </bean>
    <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref local="sessionFactory"/>
        </property>
    </bean>
    
    
    <!-- New stuff-->
    
    <bean id="progTarget" class="com.your-stuff-here.ProgressDAO">
        <property name="sessionFactory"><ref local="sessionFactory"/></property>
    </bean>    
    
    <bean id="prog" parent="txProxyTemplate">
           <property name="target">
              <ref local="progTarget"/>    
        </property>
    </bean>
   
    <bean id="txProxyTemplate" lazy-init="true"
        class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager"><ref local="transactionManager"/></property>
        <property name="transactionAttributes">
            <props>
                <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="refresh">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="merge">PROPAGATION_REQUIRED</prop>
                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                <prop key="save">PROPAGATION_REQUIRED</prop>
                <prop key="create*">PROPAGATION_REQUIRES_NEW</prop>
                <prop key="copy*">PROPAGATION_REQUIRES_NEW</prop>
                <prop key="authenticate">PROPAGATION_REQUIRED,readOnly</prop>
            </props>
        </property>
    </bean>
    
    <!-- End new stuff -->
    
    <!-- Add DAOs here -->
    <bean id="progressDAO" class="com.your-stuff-here.ProgressDAO">
        <property name="sessionFactory">
            <ref local="sessionFactory"/>
        </property>
    </bean>
</beans>
it worked for me, and it was cool that it worked, because hibernate rocks appserver. it's not even funny.
 
BlindAbraxas

Cool username.:cool:

(If it's one of those 'dark arts'/heavy metal things, it's not quite so cool, but I still like it.)
 
Back
Top