[rules-users] [Drools Flow 5.1] persistence + spring + localTransaction

Greg Stasica gstasica at pacemetrics.com
Fri May 27 05:43:22 EDT 2011


hi,

sorry but i've never tried to use something else. My application uses 
spring so there was no other option for me.

On 25/05/2011 20:16, anton.litvinenko wrote:
> Greg, were you able to achieve process persistence in other configurations?
> (e.g. without spring?)
>
> I don't use drools-spring bean factories to instantiate KnowledgeAgent and
> KnoweldgeBase (instead i created alternative factories) + the following JPA
> definition and spring context
>
> persistence.xml:
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <persistence version="1.0"
>               xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
> http://java.sun.com/xml/ns/persistence/orm
> http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
>               xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
>               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>               xmlns="http://java.sun.com/xml/ns/persistence">
>
>      <persistence-unit name="org.drools.persistence.jpa">
>          <provider>org.hibernate.ejb.HibernatePersistence</provider>
>          <class>org.drools.persistence.session.SessionInfo</class>
>
> <class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
>
> <class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
>          <class>org.drools.persistence.processinstance.WorkItemInfo</class>
>
> <class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
>
> <class>org.drools.persistence.processinstance.variabletypes.SerializablePersistedVariable</class>
>
> <class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
>          <properties>
>              <property name="hibernate.dialect"
> value="org.hibernate.dialect.PostgreSQLDialect"/>
>              <property name="hibernate.max_fetch_depth" value="3"/>
>              <property name="hibernate.hbm2ddl.auto" value="update"/>
>              <property name="hibernate.show_sql" value="true"/>
>              <property name="hibernate.connection.autocommit" value="false"/>
>          </properties>
>      </persistence-unit>
> </persistence>
>
> ApplicationContext.xml:
>      <bean id="entityManagerFactory"
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>          <property name="dataSource" ref="dataSource"/>
>          <property name="loadTimeWeaver">
>              <bean
> class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
>          </property>
>      </bean>
>
>      <jee:jndi-lookup id="dataSource" jndi-name="jdbc/flowengine"/>
>
>      <bean id="transactionManager"
> class="org.springframework.orm.jpa.JpaTransactionManager">
>          <constructor-arg type="javax.persistence.EntityManagerFactory"
> ref="entityManagerFactory"/>
>      </bean>
>
>      <tx:annotation-driven transaction-manager="transactionManager"/>
>
> This kinda works, but I have to start transaction manually before invoking
> any method on Drools Flow. And of course if an exception happens during the
> invocation then everything is rolled back (e.g. process with 3 steps and the
> last step crashes then process state in database is not updated with 2 first
> steps).
>
> Is it possible to configure Drools Flow to start/commit transaction at
> before/after process step?
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-Flow-5-1-persistence-spring-localTransaction-tp2875263p2985689.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

-- 
Greg Stasica

PaceMetrics Ltd.
T  +353 1 8849921

PaceMetrics Limited is registered in Ireland as a private company limited by shares, Registration  No.  298243,  Registered office:  PaceMetrics House, East Point Business Park, Dublin 3. This e-mail may contain confidential, proprietary or privileged information. If you are not the intended recipient (or have received this e-mail in error) please destroy this e-mail and notify the sender immediately by telephoning +353 1 8184000. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.





More information about the rules-users mailing list