-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Can we use Hibernate Transaction Manager for lobhandler
PostPosted: Thu Jun 25, 2009 6:51 am 
Newbie

Joined: Thu Jun 25, 2009 6:03 am
Posts: 1
Hi all,
I am new to the field of Hibernate and I am doing some POC work on it. I wanted to know is it possible to have a single Hibernate Transaction Manger which will take care of transaction for lobhandler also.

Currently my TestList.hbm.xml is having the following clob property
Code:
<property name="query" type="org.springframework.orm.hibernate3.support.ClobStringType">
         <column name="QUERY_CLOB" not-null="false" sql-type="clob"/>
      </property>

Corresponding java class has it mapped to a String field
Code:
    /**
     * @hibernate.property column="QUERY"
     */
   public String getQuery() {
      return query;
   }
   public void setQuery(String query) {
      this.query = query;
   }

Please find below my config file being loaded by spring.
Code:
<!--  Hibernate Session Factory -->
   <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="mappingResources">
         <list>
                <value>test/model/TestList.hbm.xml</value>
         </list>
      </property>
      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.connection.datasource">java:TEST_DS</prop>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
            <prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</prop>            
            <prop key="hibernate.connection.autocommit">false</prop>
            <prop key="hibernate.connection.release_mode">auto</prop>            
         </props>
      </property>
               <property name="lobHandler">
         <ref bean="oracleLobHandler"/>
      </property>
              </bean>   


I am getting the below expection when executing
Code:
java.lang.IllegalStateException: Active Spring transaction synchronization or active JTA transaction with 'jtaTransactionManager' on LocalSessionFactoryBean required
at org.springframework.orm.hibernate3.support.AbstractLobType.nullSafeSet(AbstractLobType.java:218)
at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:141)
at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1617)
at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1594)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1850)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:48)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:711)
at org.hibernate.impl.SessionImpl.prepareQueries(SessionImpl.java:895)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:885)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:865)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)


Please let me know what to do

Regards
jonrand


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.