- Chapter 1. Introduction 介绍
- Chapter 2. Getting Started
- Chapter 3. Configuration
- Creating a ProcessEngine 创建 ProcessEngine
- ProcessEngineConfiguration bean
- Database configuration 数据库配置
- JNDI Datasource Configuration 数据源配置
- Supported databases 支持的数据库
- Creating the database tables 创建数据库表
- Database table names explained 理解数据库表名字
- Database upgrade 数据库升级
- Job Executor and Async Executor (since version 5.17.0)
- Job executor activation 启用 Job executor
- Async executor activation 启用 Async executor
- Mail server configuration 配置邮件服务器
- History configuration 配置历史
- Exposing configuration beans in expressions and scripts 在表达式和脚本中暴露配置
- Deployment cache configuration 配置部署缓存
- Logging 日志
- Mapped Diagnostic Contexts 映射诊断上下文
- Event handlers 事件处理
- Chapter 4. The Activiti API
- Chapter 5. Spring integration 集成 Spring
- Chapter 6. Deployment
- Chapter 7. BPMN 2.0 Introduction
- Chapter 8. BPMN 2.0 Constructs 关于 BPMN 2.0 架构
- Chapter 9. Forms 表单
- Chapter 10. JPA
- Chapter 11. History 历史
- Chapter 12. Eclipse Designer
- Chapter 13. Activiti Explorer
- Chapter 14. Activiti Modeler
- Chapter 15. REST API
- Chapter 16. CDI integration 集成 CDI
- Chapter 17. LDAP integration 集成 LDAP
- Chapter 18. Advanced 高级
- Hooking into process parsing 监听流程解析
- UUID id generator for high concurrency 高并发的 UUID 生成器
- Multitenancy 多租户
- Execute custom SQL 执行自定义 SQL
- Advanced Process Engine configuration with a ProcessEngineConfigurator 用 ProcessEngineConfigurator 实现高级引擎配置
- Advanced query API seamless switching between runtime and historic task querying 高级查询 API-运行时无缝任务切换和历史任务查询
- Custom identity management by overriding standard SessionFactory 通过重写标准的 SessionFactory 实现自定义身份的管理
- Enable safe BPMN 2.0 xml 启用安全的 BPMN 2.0 xml
- Event logging Experimental 事件日志-实验
- Introduction 介绍
- CrystalBall inside 内部
- History analysis 历史分析
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Creating the database tables 创建数据库表
下面是创建数据库表最简单的办法:
- 把 activiti-engine 的 jar 放到 classpath 下
- 添加对应的数据库驱动
- 把 Activiti 配置文件 (activiti.cfg.xml) 放到 classpath 下, 指向你的数据库(参考 数据库配置 章节)
- 执行 DbSchemaCreate 类的 main 方法
不过,一般情况只有数据库管理员才能执行 DDL 语句。 在生产环境,这也是最明智的选择。SQL DDL 语句可以从 Activiti 下载页或 Activiti 发布目录里找到,在 database 子目录下。 脚本 也包含在引擎的 jar 中(activiti-engine-x.jar), 在 org/activiti/db/create 包下(drop 目录里是删除语句)。 SQL 文件的命名方式如下
activiti.{db}.{create|drop}.{type}.sql
其中 db 是 支持的数据库 , type 是
- engine: 引擎执行的表。必须。
- identity: 包含用户,群组,用户与组之间的关系的表。 这些表是可选的,只有使用引擎自带的默认身份管理时才需要。
- history: 包含历史和审计信息的表。可选的:历史级别设为 none 时不会使用。 注意这也会引用一些需要把数据保存到历史表中的功能(比如任务的评论)。
MySQL 用户需要注意: 版本低于 5.6.4 的 MySQL 不支持毫秒精度的 timestamp 或 date 类型。 更严重的是,有些版本会在尝试创建这样一列时抛出异常,而有些版本则不会。 在执行自动创建/更新时,引擎会在执行过程中修改 DDL。 当使用 DD L 时,可以选择通用版本和名为 mysql55 的文件。 (它适合所有版本低于 5.6.4 的情况)。 后一个文件会将列的类型设置为没有毫秒的情况。
总结一下,对于 MySQL 版本会执行如下操作
- <5.6: 不支持毫秒精度。可以使用 DDL 文件(包含 mysql55 的文件)。可以实现自动创建/更新。
- 5.6.0 - 5.6.3: 不支持毫秒精度。无法自动创建/更新。建议更新到新的数据库版本。如果真的需要的话,也可以使用 mysql 5.5。
- 5.6.4+:支持毫秒精度。可以使用 DDL 文件(默认包含 mysql 的文件)。可以实现自动创建、更新。
注意对于已经更新了 MySQL 数据库,而且 Activiti 表已经创建/更新的情况, 必须手工修改列的类型。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论