Results 1 to 6 of 6

Thread: spring + hibernate (+ clob) transaction sychronization

  1. #1
    Join Date
    Nov 2004
    Posts
    26

    Default spring + hibernate (+ clob) transaction sychronization

    I am using spring 1.1.2 , hibernate 2.1. and oracle 9i. I am using clobs.
    When trying to access records in the db I get the following error:

    Active Spring transaction synchronization or jtaTransactionManager on LocalSessionFactoryBean plus active JTA transaction required

    I looked through the forum and saw that I need to make Spring aware of my hibernate transactions.
    I configured it exactly how the forums indicated and yet I am still getting the error. What am I doing wrong? The following is my configuration.

    Code:
     
    
    
    <bean id="mySessionFactory"
    	      class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    		<property name="mappingLocations">
    			<list>
    				<value>/WEB-INF/QueryGroup.hbm.xml</value>
    				<value>/WEB-INF/Query.hbm.xml</value>
    				<value>/WEB-INF/ReportSource.hbm.xml</value>
    				<value>/WEB-INF/FTPQueryAction.hbm.xml</value>
    				<value>/WEB-INF/EmailQueryAction.hbm.xml</value>
    				<value>/WEB-INF/FTPHost.hbm.xml</value>
    				<value>/WEB-INF/EmailAddress.hbm.xml</value>
    				<value>/WEB-INF/GroupEmailInfo.hbm.xml</value>
    			</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop>
    			</props>
    		</property>
    		<property name="dataSource">
    			<ref bean="dataSource"/>
    		</property>
    		<property name="lobHandler">
    				<ref local="oracleLobHandler"/>
    		</property>
      </bean>
      
      
      <!-- Database LOB Handling -->     
      <bean id="nativeJdbcExtractor"  class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor" lazy-init="true"/>    
      
      <bean id="oracleLobHandler"     class="org.springframework.jdbc.support.lob.OracleLobHandler">        
      		<property name="nativeJdbcExtractor">
      			<ref local="nativeJdbcExtractor"/>
      		</property>    
      </bean> 
    <!-- Hibernate Transaction Manager --> 
    <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> 
    		  	<property name="sessionFactory">
    											<ref bean="mySessionFactory"/>
    					</property>
    		  </bean>
    		  
    <bean id="myTransactionManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    					<property name="transactionManager"><ref local="transactionManager"/></property>
    					<property name="target"><ref bean="/Retriever"/></property>
    					<property name="proxyTargetClass"><value>true</value></property> 
    					<property name="transactionAttributes">
    							<props>
    									<prop key="Save*">PROPAGATION_REQUIRED</prop>
    			            <prop key="save*">PROPAGATION_REQUIRED</prop>
    			            <prop key="get*">PROPAGATION_REQUIRED</prop>
    									<prop key="list*">PROPAGATION_REQUIRED</prop>			            
    							</props>
    					</property>
    	</bean>   
      
      
      <bean name="/Retriever" class="net.idt.ReportEngine.Editor.GroupEditor">
    						<property name="queryGroupDao"><ref bean="QueryGroupDao"/></property>
    	</bean>
    <bean id="QueryGroupDao" class="net.idt.ReportEngine.dao.QueryGroupDao">
    					<property name="sessionFactory">
    							<ref bean="mySessionFactory"/>
    					</property>
    	</bean>

  2. #2
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    Do you not need to explictly wrap "/Retriever"?

    My understanding (which is probably wrong ) is that you define your transactionManager, then define your bean, and then define a transactionAware proxy whose name is the bean you are wrapping, i.e.:

    <bean id="/RetrieverTarget" class="net.idt etc
    <bean name="/Retriever" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces">
    <value>org.springframework.web.servlet.mvc.Control ler</value>
    </property>
    <property name="interceptorNames">
    <list>
    <value>transactionInterceptor</value>
    <value>/RetrieverTarget</value>
    </list>
    </property>
    </bean>

  3. #3
    Join Date
    Nov 2004
    Posts
    26

    Default

    expert one-on one says that TransactionProxyFactoryBean is an alternative simplified way of proxy coniguration. Using this you don't have to set up AOP proxyfactorybean.

    So what am I doing wrong?

  4. #4
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    No idea then.

    Try throwing an exception in the middle of your business object so you can see exactly what is being adviced?

  5. #5
    Join Date
    Jun 2005
    Posts
    4

    Default same problem

    I'm having the exact same problems but trying to configure BLOBs... I trying several things and got to the same error as you. Will try some more and ler you know if I find something.
    Jimmy G.
    Software Developer

  6. #6
    Join Date
    Nov 2004
    Posts
    26

    Default

    when I configured it this way it works
    Code:
    		  <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> 
    		  	<property name="sessionFactory">
    											<ref bean="mySessionFactory"/>
    					</property>
    		  </bean>
    		  
    		  <bean id="myTransactionManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    					<property name="transactionManager"><ref local="transactionManager"/></property>
    					<property name="target"><ref bean="/Retriever"/></property>
    					<property name="proxyTargetClass"><value>true</value></property> 
    					<property name="transactionAttributes">
    							<props>
    
    
    			            <prop key="getGroups">PROPAGATION_REQUIRED</prop>
    
    									<prop key="*">PROPAGATION_REQUIRED</prop>
    						
    							</props>
    					</property>
    	</bean>   
    
    	<bean name="/Retriever" parent="myTransactionManager">
    	        <property name="target">
    	            <bean class="net.idt.ReportEngine.Editor.GroupEditor">
    	                <property name="queryGroupDao">
    	                    <ref bean="QueryGroupDao"/>
    	                </property>
    	                	            </bean>
    	        </property>
    	    </bean>

    However I now have a different problem.
    Posted: Wed Jun 08, 2005 9:36 am Post subject: ContextLoaderPlugIn problem

    --------------------------------------------------------------------------------

    I am using the ContextLoaderPlugIn.

    What do I do in the case where I have multiple struts actions that maps to the same class?
    They need to be different mappings because they are coming from different forms and therefore have different actionforms.
    I saw I can overide the bean name to map to with determineActionBeanName. How do I implement this?

Similar Threads

  1. Replies: 3
    Last Post: Aug 16th, 2007, 12:10 PM
  2. Replies: 2
    Last Post: Aug 31st, 2005, 12:37 PM
  3. Replies: 0
    Last Post: Jun 6th, 2005, 06:22 AM
  4. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  5. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •