日期:2014-05-16  浏览次数:20537 次

不能在对象 'dbo.JBPM_PROCESSINSTAN,悲剧,sql2005下的错误
Hibernate: select top 1 processdef0_.ID_ as ID1_8_, processdef0_.NAME_ as NAME3_8_, processdef0_.DESCRIPTION_ as DESCRIPT4_8_, processdef0_.VERSION_ as VERSION5_8_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_8_, processdef0_.STARTSTATE_ as STARTSTATE7_8_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc
38
Hibernate: insert into JBPM_TOKEN (VERSION_, NAME_, START_, END_, NODEENTER_, NEXTLOGINDEX_, ISABLETOREACTIVATEPARENT_, ISTERMINATIONIMPLICIT_, ISSUSPENDED_, LOCK_, NODE_, PROCESSINSTANCE_, PARENT_, SUBPROCESSINSTANCE_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into JBPM_PROCESSINSTANCE (VERSION_, KEY_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_) values (?, ?, ?, ?, ?, ?, ?, ?)
2010-12-12 17:55:03 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
com.microsoft.sqlserver.jdbc.SQLServerException: 违反了 UNIQUE KEY 约束 'UQ__JBPM_PROCESSINST__2C3393D0'。不能在对象 'dbo.JBPM_PROCESSINSTANCE' 中插入重复键。





解决办法
jbpm为了兼容众多数据库 ,在processinstance表中多出了一个 key字段。
在sql2005中 需要
processInstance.setKey(processInstance.getId() + "");
这样就ok