Что у меня есть:Activiti с JPA: отношение "act_hi_procinst" уже существует
Я пытаюсь настроить Activiti использовать JPA менеджер транзакций. см. Раздел кода ниже Я определяю конфигурации базы данных как в processEngineConfiguration bean и в jpa-persistance.xml.
Какая проблема:
Я получить org.postgresql.util.PSQLException: ОШИБКА: отношение act_hi_procinst уже существует исключение,
Вопрос:
Как решить проблему?
Код:
applicationContext.xml
<bean id="activitiDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/activiti-transaction-demo" />
<property name="username" value="postgres" />
<property name="password" value="Volodumur6894834" />
</bean>
<bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="persistenceXmlLocation">
<value>classpath:jpa-persistence.xml</value>
</property>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager" ref="persistenceUnitManager" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="databaseType" value="postgres" />
<property name="dataSource" ref="activitiDataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="create" />
<property name="jpaEntityManagerFactory" ref="entityManagerFactory" />
<property name="jpaHandleTransaction" value="true" />
<property name="jpaCloseEntityManager" value="true" />
<property name="deploymentResources" value="classpath*:process/simplest_process.bpmn20.xml" />
<property name="jobExecutorActivate" value="false" />
<property name="history" value="full"/>
</bean>
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
JPA-persistance.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
<persistence-unit name="Client" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>name.krestjaninoff.activiti.hello.db.Client</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.ProgressDialect" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/activiti-transaction-demo" />
<property name="hibernate.connection.username" value="postgres" />
<property name="hibernate.connection.password" value="Volodumur6894834" />
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>