|
The com.opensymphony.workflow.spi.hibernate.SpringHibernateWorkflowFactory is a workflow factory that allows definitions to be stored in a relational DB. Compared to JDBCWorkflowFactory this doesn't persist the descriptor in a binary column. Instead a normalised form of the workflow descriptor is saved. This way it's possible to create and modify workflows in the database using traditional relational tools. For example a workflow defined in a legacy system (an OS/390 Mainframe) that need to be modified and reloaded without user intervention. Exporting a flow from the mainframe and importing it into the Factory tables will do the work. The current implementation requires both Spring and hibernate to be in use. Change your Spring definition file to point to the new factory and to add the new Hibernate mapping file: <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"><ref local="dataSource"/></property> <property name="mappingResources"> <list> <value>com/opensymphony/workflow/spi/hibernate/WorkflowDescriptor.hbm.xml</value> <value>com/opensymphony/workflow/spi/hibernate/HibernateCurrentStep.hbm.xml</value> <value>com/opensymphony/workflow/spi/hibernate/HibernateHistoryStep.hbm.xml</value> <value>com/opensymphony/workflow/spi/hibernate/HibernateWorkflowEntry.hbm.xml</value> <value>com/opensymphony/module/propertyset/hibernate/PropertySetItemImpl.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">net.sf.hibernate.dialect.MckoiDialect</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.hbm2ddl.auto">create-drop</prop> </props> </property> </bean> and then replace the workflowFactory definition: <bean id="workflowFactory" class="com.opensymphony.workflow.spi.hibernate.SpringHibernateWorkflowFactory" init-method="initDone"> <property name="sessionFactory"><ref bean="sessionFactory"/></property> <property name="reload"><value>true</value></property> <property name="validate"><value>false</value></property> </bean> Creating an example of the populated tablesIt's sufficient to read an existing osworkflow definition file and then persist it on the DB tables using Hibernate save. This way all tables will be correctly populated and you will have a live working example of the Factory. VersioningThere isn't automatic support for workflow versioning, but updating the reference from the WorkflowName table will be sufficient for most versioning needs. Doing so enables you to have all the previous WorfklowDescriptors and only one active (the one pointed by WorkflowName). |