cocoon-users-fr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thuertas <tugdual.huer...@aql.fr>
Subject [cocoon 2.2] Spring transactions and transformers
Date Fri, 21 Sep 2007 12:53:18 GMT
Hi,

I'm using spring to manage the transactions in my cocoon transformers 
and generators.
Here is the problem: with the generators, everything is ok (my Hibernate 
beans are stored in the database) but when I use Transformers, it looks 
like there is no "commit" done --> no exception and the persist on the 
beans are done!

Here are my files:

application-context:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:configurator="http://cocoon.apache.org/schema/configurator"
    xmlns:avalon="http://cocoon.apache.org/schema/avalon"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util-2.0.xsd
       http://cocoon.apache.org/schema/configurator 
http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.xsd
       http://cocoon.apache.org/schema/avalon 
http://cocoon.apache.org/schema/avalon/cocoon-avalon-1.0.xsd
       http://www.springframework.org/schema/jee 
http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
       http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

 <bean id="maTransactionManager"
        
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
  </bean>

<bean 
name="org.apache.cocoon.transformation.Transformer/importTestTransformer"
        
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager">
            <ref bean="maTransactionManager" />
        </property>
        <property name="target">
            <bean id="importTestGeneratorWithoutTransaction"
                class="com.mycompany.transform.ImportTestGenerator">
                <property name="colorHelper">
                    <ref bean="ColorHelper" />
                </property>
                <property name="sessionFactory">
                    <ref bean="sessionFactory" />
                </property>
            </bean>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="write*">
                    PROPAGATION_REQUIRED
                </prop>
            </props>
        </property>
    </bean>
</beans>



sitemap:xmap:

<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://apache.org/cocoon/sitemap/1.0
             
http://cocoon.apache.org/schema/sitemap/cocoon-sitemap-1.0.xsd" 
xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <map:flow language="javascript"/>

   <map:components>
        <map:generators default="file">
            <map:generator name="file" 
src="org.apache.cocoon.generation.FileGenerator"/>
            <map:generator name="stream" 
src="org.apache.cocoon.generation.StreamGenerator"/>
        </map:generators>
    </map:components>

    <map:pipelines>
        <map:pipeline>  <!-- Used for test only -->
            <map:match pattern="importTestGenerator">
               <map:generate type="stream">
                  <map:parameter name="defaultContentType" 
value="text/xml"/>
                </map:generate>
                <map:transform type="importTestGenerator"/>
                <map:serialize type="xml"/>
            </map:match>
        </map:pipeline>
    </map:pipelines>

---------------------------------------------------------------------
Liste francophone Apache Cocoon -- http://cocoon.apache.org/fr/
Pour vous desinscrire : mailto:users-fr-unsubscribe@cocoon.apache.org
Autres commandes : mailto:users-fr-help@cocoon.apache.org


Mime
View raw message