<?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:kie="http://drools.org/schema/kie-spring"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                          http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd
                          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

  <bean id="hsDs" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.h2.Driver"/>
    <property name="url" value="jdbc:h2:mem:drools-spring-workflow;MVCC=true"/>
    <property name="username" value="sa"/>
    <property name="password" value=""/>
  </bean>

  <bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="org.drools.persistence.jpa.local"/>
    <property name="dataSource" ref="hsDs"/>
  </bean>

  <bean id="txMgr" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="emf"/>
  </bean>
  
  <context:annotation-config/>

  <bean name="myDroolsBean" class="org.kie.spring.timer.MyDroolsBean">
    <property name="emf" ref="emf"/>
    <property name="kbase" ref="drl_timer_flow"/>
    <property name="kstore" ref="knowledgeStore"/>
    <property name="txm" ref="txMgr"/>
  </bean>


  <kie:kstore id="knowledgeStore"/>

  <kie:kmodule id="persistence_spring_module">
  
    <kie:kbase name="drl_timer_flow" packages="drl_timer_flow">
     <kie:ksession name="jpaSSCS">
        <kie:configuration>
          <kie:jpa-persistence>
            <kie:transaction-manager ref="txMgr"/>
            <kie:entity-manager-factory ref="emf"/>
          </kie:jpa-persistence>
        </kie:configuration>
      </kie:ksession>
    </kie:kbase>
    
  </kie:kmodule>

 
</beans>
