JBPM4.4的搭建与配置

1:下载插件安装包。进行eclipse插件的安装。如下所示
JBPM4.4的搭建与配置

JBPM4.4的搭建与配置

 

2:安装完成之后,会看到如图所示,表示安装成功
JBPM4.4的搭建与配置
如此则表示安装完成

 

3:配置项目

JBPM4.4的搭建与配置

将上述的文件添加到项目中。

 

4:修改jbpm.hibernate.cfg.xml

 

 

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
	<session-factory>

		<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
		<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
		<property name="hibernate.connection.url">jdbc:mysql:///jbpm4_mysql?characterEncoding=UTF-8</property>
		<property name="hibernate.connection.username">root</property>
		<property name="hibernate.connection.password">123456</property>
		<!-- 第一次运行项目的时候,用create-drop,这样可以自动在数据库中创建表 -->
		<!-- <property name="hibernate.hbm2ddl.auto">create-drop</property> -->
		<property name="hibernate.hbm2ddl.auto">update</property>
		<!-- <property name="hibernate.format_sql">true</property> -->

		<mapping resource="jbpm.repository.hbm.xml" />
		<mapping resource="jbpm.execution.hbm.xml" />
		<mapping resource="jbpm.history.hbm.xml" />
		<mapping resource="jbpm.task.hbm.xml" />
		<mapping resource="jbpm.identity.hbm.xml" />

	</session-factory>
</hibernate-configuration>

  注释:

 

<property name="hibernate.hbm2ddl.auto"></property>

 

这个属性标签中有四个参数可以写,这四个参数是对数据库中插入的进行不同的操作,分别为:

(1)create-drop

(2)create

(3)update

(4)validate

下面分别来介绍他们的作用以及对数据库中的影响

(1)<property name="hibernate.hbm2ddl.auto"> create-drop </property>

create-drop:表示在hebarinate初始化时创建表格,程序运行结束的时候会删除相应的表格,在实际项目中不用

 

(2)<property name="hibernate.hbm2ddl.auto">create</property>

在hibernate初始化时会创建表格,在运行结束之后不删除表格,而是在下一次运行的时候如果有旧的删掉,没有旧的,重新建表格

 

(3)<property name="hibernate.hbm2ddl.auto">update</property>

只是根据映射文件去和数据库中的表对应起来,如果不一致,就更新表的结构

 

(4)<property name="hibernate.hbm2ddl.auto">validate</property>

校验映射文件和数据库中的表是不是能对应起来,不能对应报错,实际中常用

 

5:MAVEN配置

<repositories>
		<repository>
			<id>maven</id>
			<url>http://repo1.maven.org/maven2/</url>
		</repository>
		<repository>
			<id>jboss</id>
			<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
		</repository>
	</repositories>
//===========================================================================
<!-- jBPM4.4 -->
		<dependency>
			<groupId>org.jbpm.jbpm4</groupId>
			<artifactId>jbpm-api</artifactId>
			<version>4.4</version>
		</dependency>
		<dependency>
			<groupId>org.jbpm.jbpm4</groupId>
			<artifactId>jbpm-log</artifactId>
			<version>4.4</version>
		</dependency>
		<dependency>
			<groupId>org.jbpm.jbpm4</groupId>
			<artifactId>jbpm-bpmn</artifactId>
			<version>4.4</version>
			<exclusions>
				<exclusion>
					<groupId>junit</groupId>
					<artifactId>junit</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.beanshell</groupId>
					<artifactId>bsh</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.jbpm.jbpm4</groupId>
			<artifactId>jbpm-db</artifactId>
			<version>4.4</version>
			<exclusions>
				<exclusion>
					<groupId>hsqldb</groupId>
					<artifactId>hsqldb</artifactId>
				</exclusion>
				<exclusion>
					<groupId>mysql</groupId>
					<artifactId>mysql-connector-java</artifactId>
				</exclusion>
				<exclusion>
					<groupId>postgresql</groupId>
					<artifactId>postgresql</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.jbpm.jbpm4</groupId>
			<artifactId>jbpm-jpdl</artifactId>
			<version>4.4</version>
			<exclusions>
				<exclusion>
					<groupId>junit</groupId>
					<artifactId>junit</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.jbpm.jbpm4</groupId>
			<artifactId>jbpm-pvm</artifactId>
			<version>4.4</version>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-jdk14</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.hibernate</groupId>
					<artifactId>hibernate-core</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>xerces</groupId>
			<artifactId>xercesImpl</artifactId>
			<version>2.9.1</version>
		</dependency>
		<!-- slf4j -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.6.1</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.6.1</version>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
		<!-- Hibernate -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.3.7.Final</version>
		</dependency>
		<!-- java mail -->
		<dependency>
			<groupId>javax.mail</groupId>
			<artifactId>mail</artifactId>
			<version>1.4</version>
		</dependency>
		<!-- jbpm end -->

 

你可能感兴趣的:(maven,配置,JBPM4.4,搭建)