jBPM4.4中配备MySQL的hibernate方言MySQLInnoDBDialect
来源:互联网 发布:淘宝售后管理软件 编辑:程序博客网 时间:2024/05/02 00:39
很坑的一个问题。如果使用错误的mysql方言,则在级联删除的时候,会报mysql级联删除错误。
jBPM4.4中配置MySQL的hibernate方言MySQLInnoDBDialect
最初的jbpm.hibernate.cfg.xml中,对MySQL的方言配置成了 org.hibernate.dialect.MySQLDialect,发布流程的时候遇到下述错误:Cannot delete or update a parent row: a foreign key constraint fails
Could not synchronize database state with session
将MySQL方言修改为 org.hibernate.dialect.MySQLInnoDBDialect问题解决
看着上面好像问题是解决了:不过我却发现了一个问题,就是自动建表的问题,先看下面的代码:
<?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> <!-- 不知道为什么,把hibernate.dialect改成org.hibernate.dialect.MySQLInnoDBDialect,,如果你把表删除了的话,不能自动建表 但是运行的时候又得换成org.hibernate.dialect.MySQLInnoDBDialect才不会报错,,,纠结了。。 --> <!-- <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> --> <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://localhost:3306/jbpm</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">root</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">update</property>是习以为常的自动建表语句,它的属性值有:create , update ,create-drop等等,代表不同的建表模式。
我是调用java代码来建表的,如下:
public static void main(String arg[]) {//必须使用的,流程引擎ProcessEngine processEngine = Configuration.getProcessEngine();RepositoryService repositoryService = processEngine.getRepositoryService();}
结果发现这样的方式只能用 org.hibernate.dialect.MySQLInnoDBDialect这个方言才能使用,换成了 org.hibernate.dialect.MySQLInnoDBDialect的话只能删除,不能重新建表了。。。。真是个奇怪的问题?有没有知道原因的?
0 0
- jBPM4.4中配备MySQL的hibernate方言MySQLInnoDBDialect
- jBPM4中配置MySQL的hibernate方言MySQLInnoDBDialect
- jBPM4中配置MySQL的hibernate方言
- 关于配置了数据库方言为MySQLInnoDBDialect后Hibernate不能自动建表的问题
- 关于配置了数据库方言为MySQLInnoDBDialect后Hibernate不能自动建表的问题
- mysql版本导致的hibernate 方言问题
- 代码中获取hibernate 方言的方式
- hibernate中数据库方言的错误
- Hibernate中SQLite方言
- Hibernate中SQL方言
- hibernate 的SQL方言
- hibernate支持的方言
- hibernate 方言的作用
- hibernate的方言
- hibernate的方言是什么??
- hibernate使用MySQLInnoDBDialect不能自动建表的问题
- mysql 让hibernate支持text字段的方言
- 不同MySql版本问题需要的Hibernate 方言问题
- 关于PowerShell中PassThru的实际作用
- tomcat部署solr
- 分布式Unique ID的生成方法一览
- C语言文件读写操作总结
- 数据库之768,702版本之间问题
- jBPM4.4中配备MySQL的hibernate方言MySQLInnoDBDialect
- Android Monkey测试工具的使用
- 黑科技:程序猿如何打造属于自己的分体键盘
- 运用委托是注意异步调用
- 使用 toString.call()方法判断数据类型
- codeforces 361B 思维题
- 识别工具
- STM32不使用外部晶振的接法
- java输出重定向