提交 d8a671a1 编写于 作者: T Tijs Rademakers

Fix database table name length constraint

上级 aee4ca75
......@@ -39,9 +39,9 @@ public class TableDataManagerImpl implements TableDataManager {
public static Map<Class<? extends Entity>, String> entityToTableNameMap = new HashMap<>();
static {
entityToTableNameMap.put(CmmnDeploymentEntity.class, "ACT_CMMN_RE_DEPLOYMENT");
entityToTableNameMap.put(CmmnResourceEntity.class, "ACT_CMMN_RE_DEPLOYMENT_RESOURCE");
entityToTableNameMap.put(CaseDefinitionEntity.class, "ACT_CMMN_RE_CASEDEF");
entityToTableNameMap.put(CmmnDeploymentEntity.class, "ACT_CMMN_DEPLOYMENT");
entityToTableNameMap.put(CmmnResourceEntity.class, "ACT_CMMN_DEPLOYMENT_RESOURCE");
entityToTableNameMap.put(CaseDefinitionEntity.class, "ACT_CMMN_CASEDEF");
entityToTableNameMap.put(CaseInstanceEntity.class, "ACT_CMMN_RU_CASE_INST");
entityToTableNameMap.put(PlanItemInstanceEntity.class, "ACT_CMMN_RU_PLAN_ITEM_INST");
entityToTableNameMap.put(SentryPartInstanceEntity.class, "ACT_CMMN_RU_SENTRY_PART_INST");
......
......@@ -7,7 +7,7 @@
<changeSet id="1" author="flowable">
<createTable tableName="ACT_CMMN_RE_DEPLOYMENT">
<createTable tableName="ACT_CMMN_DEPLOYMENT">
<column name="ID_" type="varchar(255)">
<constraints primaryKey="true" nullable="false" />
</column>
......@@ -26,7 +26,7 @@
</column>
</createTable>
<createTable tableName="ACT_CMMN_RE_DEPLOYMENT_RESOURCE">
<createTable tableName="ACT_CMMN_DEPLOYMENT_RESOURCE">
<column name="ID_" type="varchar(255)">
<constraints primaryKey="true" nullable="false" primaryKeyName="PK_CMMN_DEPLOYMENT_RESOURCE" />
</column>
......@@ -38,16 +38,16 @@
</createTable>
<addForeignKeyConstraint constraintName="ACT_FK_CMMN_RSRC_DPL"
referencedTableName="ACT_CMMN_RE_DEPLOYMENT"
referencedTableName="ACT_CMMN_DEPLOYMENT"
referencedColumnNames="ID_"
baseTableName="ACT_CMMN_RE_DEPLOYMENT_RESOURCE"
baseTableName="ACT_CMMN_DEPLOYMENT_RESOURCE"
baseColumnNames="DEPLOYMENT_ID_" />
<createIndex tableName="ACT_CMMN_RE_DEPLOYMENT_RESOURCE" indexName="ACT_IDX_CMMN_RSRC_DPL">
<createIndex tableName="ACT_CMMN_DEPLOYMENT_RESOURCE" indexName="ACT_IDX_CMMN_RSRC_DPL">
<column name="DEPLOYMENT_ID_" />
</createIndex>
<createTable tableName="ACT_CMMN_RE_CASEDEF">
<createTable tableName="ACT_CMMN_CASEDEF">
<column name="ID_" type="varchar(255)">
<constraints primaryKey="true" nullable="false" />
</column>
......@@ -72,12 +72,12 @@
</createTable>
<addForeignKeyConstraint constraintName="ACT_FK_CASE_DEF_DPLY"
referencedTableName="ACT_CMMN_RE_DEPLOYMENT"
referencedTableName="ACT_CMMN_DEPLOYMENT"
referencedColumnNames="ID_"
baseTableName="ACT_CMMN_RE_CASEDEF"
baseTableName="ACT_CMMN_CASEDEF"
baseColumnNames="DEPLOYMENT_ID_" />
<createIndex tableName="ACT_CMMN_RE_CASEDEF" indexName="ACT_IDX_CASE_DEF_DPLY">
<createIndex tableName="ACT_CMMN_CASEDEF" indexName="ACT_IDX_CASE_DEF_DPLY">
<column name="DEPLOYMENT_ID_" />
</createIndex>
......@@ -101,7 +101,7 @@
</createTable>
<addForeignKeyConstraint constraintName="ACT_FK_CASE_INST_CASE_DEF"
referencedTableName="ACT_CMMN_RE_CASEDEF"
referencedTableName="ACT_CMMN_CASEDEF"
referencedColumnNames="ID_"
baseTableName="ACT_CMMN_RU_CASE_INST"
baseColumnNames="CASE_DEF_ID_" />
......@@ -138,7 +138,7 @@
</createTable>
<addForeignKeyConstraint constraintName="ACT_FK_PLAN_ITEM_CASE_DEF"
referencedTableName="ACT_CMMN_RE_CASEDEF"
referencedTableName="ACT_CMMN_CASEDEF"
referencedColumnNames="ID_"
baseTableName="ACT_CMMN_RU_PLAN_ITEM_INST"
baseColumnNames="CASE_DEF_ID_" />
......@@ -173,7 +173,7 @@
</createTable>
<addForeignKeyConstraint constraintName="ACT_FK_SENTRY_CASE_DEF"
referencedTableName="ACT_CMMN_RE_CASEDEF"
referencedTableName="ACT_CMMN_CASEDEF"
referencedColumnNames="ID_"
baseTableName="ACT_CMMN_RU_SENTRY_PART_INST"
baseColumnNames="CASE_DEF_ID_" />
......@@ -224,7 +224,7 @@
</createTable>
<addForeignKeyConstraint constraintName="ACT_FK_MIL_CASE_DEF"
referencedTableName="ACT_CMMN_RE_CASEDEF"
referencedTableName="ACT_CMMN_CASEDEF"
referencedColumnNames="ID_"
baseTableName="ACT_CMMN_RU_MIL_INST"
baseColumnNames="CASE_DEF_ID_" />
......
......@@ -5,7 +5,7 @@
<mapper namespace="org.flowable.cmmn.engine.impl.persistence.entity.CaseDefinitionEntityImpl">
<insert id="insertCaseDefinition" parameterType="org.flowable.cmmn.engine.impl.persistence.entity.CaseDefinitionEntityImpl">
insert into ${prefix}ACT_CMMN_RE_CASEDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DESCRIPTION_, HAS_GRAPHICAL_NOTATION_ , TENANT_ID_)
insert into ${prefix}ACT_CMMN_CASEDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DESCRIPTION_, HAS_GRAPHICAL_NOTATION_ , TENANT_ID_)
values (#{id, jdbcType=VARCHAR},
1,
#{category, jdbcType=VARCHAR},
......@@ -20,7 +20,7 @@
</insert>
<insert id="bulkInsertCaseDefinition" parameterType="java.util.List">
INSERT INTO ${prefix}ACT_CMMN_RE_CASEDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DESCRIPTION_, HAS_GRAPHICAL_NOTATION_ , TENANT_ID_)
INSERT INTO ${prefix}ACT_CMMN_CASEDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DESCRIPTION_, HAS_GRAPHICAL_NOTATION_ , TENANT_ID_)
VALUES
<foreach collection="list" item="caseDefinition" index="index" separator=",">
(#{caseDefinition.id, jdbcType=VARCHAR},
......@@ -40,7 +40,7 @@
<insert id="bulkInsertCaseDefinition" databaseId="oracle" parameterType="java.util.List">
INSERT ALL
<foreach collection="list" item="caseDefinition" index="index">
INTO ${prefix}ACT_CMMN_RE_CASEDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_,
INTO ${prefix}ACT_CMMN_CASEDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_,
DESCRIPTION_, HAS_GRAPHICAL_NOTATION_ , TENANT_ID_) VALUES
(#{caseDefinition.id, jdbcType=VARCHAR},
1,
......@@ -58,7 +58,7 @@
</insert>
<update id="updateCaseDefinition" parameterType="org.flowable.cmmn.engine.impl.persistence.entity.CaseDefinitionEntityImpl">
update ${prefix}ACT_CMMN_RE_CASEDEF set
update ${prefix}ACT_CMMN_CASEDEF set
REV_ = #{revisionNext, jdbcType=INTEGER},
CATEGORY_ = #{category, jdbcType=VARCHAR}
where ID_ = #{id, jdbcType=VARCHAR}
......@@ -66,11 +66,11 @@
</update>
<delete id="deleteCaseDefinition" parameterType="org.flowable.cmmn.engine.impl.persistence.entity.CaseDefinitionEntityImpl">
delete from ${prefix}ACT_CMMN_RE_CASEDEF where ID_ = #{id}
delete from ${prefix}ACT_CMMN_CASEDEF where ID_ = #{id}
</delete>
<delete id="deleteCaseDefinitionsByDeploymentId" parameterType="string">
delete from ${prefix}ACT_CMMN_RE_CASEDEF where DEPLOYMENT_ID_ = #{deploymenId}
delete from ${prefix}ACT_CMMN_CASEDEF where DEPLOYMENT_ID_ = #{deploymenId}
</delete>
<resultMap id="caseDefinitionResultMap" type="org.flowable.cmmn.engine.impl.persistence.entity.CaseDefinitionEntityImpl">
......@@ -90,16 +90,16 @@
<!-- CASDEFINITION SELECT -->
<select id="selectCaseDefinition" parameterType="string" resultMap="caseDefinitionResultMap">
select * from ${prefix}ACT_CMMN_RE_CASEDEF where ID_ = #{caseDefinitionId, jdbcType=VARCHAR}
select * from ${prefix}ACT_CMMN_CASEDEF where ID_ = #{caseDefinitionId, jdbcType=VARCHAR}
</select>
<select id="selectCaseDefinitionById" parameterType="string" resultMap="caseDefinitionResultMap">
select * from ${prefix}ACT_CMMN_RE_CASEDEF where ID_ = #{caseDefinitionId}
select * from ${prefix}ACT_CMMN_CASEDEF where ID_ = #{caseDefinitionId}
</select>
<select id="selectCaseDefinitionByDeploymentAndKey" parameterType="map" resultMap="caseDefinitionResultMap">
select *
from ${prefix}ACT_CMMN_RE_CASEDEF
from ${prefix}ACT_CMMN_CASEDEF
where DEPLOYMENT_ID_ = #{deploymentId}
and KEY_ = #{caseDefinitionKey}
and (TENANT_ID_ = '' or TENANT_ID_ is null)
......@@ -107,7 +107,7 @@
<select id="selectCaseDefinitionByDeploymentAndKeyAndTenantId" parameterType="map" resultMap="caseDefinitionResultMap">
select *
from ${prefix}ACT_CMMN_RE_CASEDEF
from ${prefix}ACT_CMMN_CASEDEF
where DEPLOYMENT_ID_ = #{deploymentId}
and KEY_ = #{caseDefinitionKey}
and TENANT_ID_ = #{tenantId}
......@@ -115,30 +115,30 @@
<select id="selectCaseDefinitionsByKeyAndVersion" parameterType="org.flowable.engine.common.impl.db.ListQueryParameterObject" resultMap="caseDefinitionResultMap">
select *
from ${prefix}ACT_CMMN_RE_CASEDEF
from ${prefix}ACT_CMMN_CASEDEF
where KEY_ = #{parameter.caseDefinitionKey} and VERSION_ = #{parameter.caseDefinitionVersion} and (TENANT_ID_ = '' or TENANT_ID_ is null)
</select>
<select id="selectCaseDefinitionsByKeyAndVersionAndTenantId" parameterType="org.flowable.engine.common.impl.db.ListQueryParameterObject" resultMap="caseDefinitionResultMap">
select *
from ${prefix}ACT_CMMN_RE_CASEDEF
from ${prefix}ACT_CMMN_CASEDEF
where KEY_ = #{parameter.caseDefinitionKey} and VERSION_ = #{parameter.caseDefinitionVersion} and TENANT_ID_ = #{parameter.tenantId}
</select>
<select id="selectLatestCaseDefinitionByKey" parameterType="string" resultMap="caseDefinitionResultMap">
select *
from ${prefix}ACT_CMMN_RE_CASEDEF
from ${prefix}ACT_CMMN_CASEDEF
where KEY_ = #{key} and
(TENANT_ID_ = '' or TENANT_ID_ is null) and
VERSION_ = (select max(VERSION_) from ${prefix}ACT_CMMN_RE_CASEDEF where KEY_ = #{caseDefinitionKey} and (TENANT_ID_ = '' or TENANT_ID_ is null))
VERSION_ = (select max(VERSION_) from ${prefix}ACT_CMMN_CASEDEF where KEY_ = #{caseDefinitionKey} and (TENANT_ID_ = '' or TENANT_ID_ is null))
</select>
<select id="selectLatestCaseDefinitionByKeyAndTenantId" parameterType="map" resultMap="caseDefinitionResultMap">
select *
from ${prefix}ACT_CMMN_RE_CASEDEF
from ${prefix}ACT_CMMN_CASEDEF
where KEY_ = #{caseDefinitionKey} and
TENANT_ID_ = #{tenantId} and
VERSION_ = (select max(VERSION_) from ${prefix}ACT_CMMN_RE_CASEDEF where KEY_ = #{caseDefinitionKey} and TENANT_ID_ = #{tenantId})
VERSION_ = (select max(VERSION_) from ${prefix}ACT_CMMN_CASEDEF where KEY_ = #{caseDefinitionKey} and TENANT_ID_ = #{tenantId})
</select>
<select id="selectCaseDefinitionsByQueryCriteria" parameterType="org.flowable.cmmn.engine.impl.repository.CaseDefinitionQueryImpl" resultMap="caseDefinitionResultMap">
......@@ -155,7 +155,7 @@
</select>
<sql id="selectCaseDefinitionsByQueryCriteriaSql">
from ${prefix}ACT_CMMN_RE_CASEDEF RES
from ${prefix}ACT_CMMN_CASEDEF RES
<where>
<if test="id != null">
RES.ID_ = #{id}
......@@ -218,7 +218,7 @@
</foreach>
</if>
<if test="latest">
and RES.VERSION_ = (select max(VERSION_) from ${prefix}ACT_CMMN_RE_CASEDEF where KEY_ = RES.KEY_
and RES.VERSION_ = (select max(VERSION_) from ${prefix}ACT_CMMN_CASEDEF where KEY_ = RES.KEY_
<if test="tenantId != null">
and TENANT_ID_ = #{tenantId}
</if>
......
......@@ -7,7 +7,7 @@
<!-- DEPLOYMENT INSERT -->
<insert id="insertCmmnDeployment" parameterType="org.flowable.cmmn.engine.impl.persistence.entity.CmmnDeploymentEntityImpl">
insert into ${prefix}ACT_CMMN_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, TENANT_ID_, DEPLOY_TIME_, PARENT_DEPLOYMENT_ID_)
insert into ${prefix}ACT_CMMN_DEPLOYMENT(ID_, NAME_, CATEGORY_, TENANT_ID_, DEPLOY_TIME_, PARENT_DEPLOYMENT_ID_)
values(
#{id, jdbcType=VARCHAR},
#{name, jdbcType=VARCHAR},
......@@ -21,7 +21,7 @@
<!-- DEPLOYMENT UPDATE -->
<update id="updateCmmnDeployment" parameterType="org.flowable.cmmn.engine.impl.persistence.entity.CmmnDeploymentEntityImpl">
update ${prefix}ACT_CMMN_RE_DEPLOYMENT
update ${prefix}ACT_CMMN_DEPLOYMENT
<set>
<if test="originalPersistentState.category != category">
CATEGORY_ = #{category, jdbcType=VARCHAR},
......@@ -36,7 +36,7 @@
<!-- DEPLOYMENT DELETE -->
<delete id="deleteCmmnDeployment" parameterType="string">
delete from ${prefix}ACT_CMMN_RE_DEPLOYMENT where ID_ = #{id}
delete from ${prefix}ACT_CMMN_DEPLOYMENT where ID_ = #{id}
</delete>
<!-- DEPLOYMENT RESULTMAP -->
......@@ -53,11 +53,11 @@
<!-- DEPLOYMENT SELECT -->
<select id="selectCmmnDeploymentsByName" parameterType="org.flowable.engine.common.impl.db.ListQueryParameterObject" resultMap="cmmnDeploymentResultMap">
select * from ${prefix}ACT_CMMN_RE_DEPLOYMENT D where NAME_=#{parameter} order by D.DEPLOY_TIME_ desc
select * from ${prefix}ACT_CMMN_DEPLOYMENT D where NAME_=#{parameter} order by D.DEPLOY_TIME_ desc
</select>
<select id="selectCmmnDeployment" parameterType="string" resultMap="cmmnDeploymentResultMap">
select * from ${prefix}ACT_CMMN_RE_DEPLOYMENT where ID_ = #{id, jdbcType=VARCHAR}
select * from ${prefix}ACT_CMMN_DEPLOYMENT where ID_ = #{id, jdbcType=VARCHAR}
</select>
<select id="selectCmmnDeploymentsByQueryCriteria" parameterType="org.flowable.cmmn.engine.impl.repository.CmmnDeploymentQueryImpl" resultMap="cmmnDeploymentResultMap">
......@@ -74,7 +74,7 @@
</select>
<sql id="selectCmmnDeploymentsByQueryCriteriaSql">
from ${prefix}ACT_CMMN_RE_DEPLOYMENT RES
from ${prefix}ACT_CMMN_DEPLOYMENT RES
<where>
<if test="deploymentId != null">
RES.ID_ = #{deploymentId}
......
......@@ -7,12 +7,12 @@
<!-- RESOURCE INSERT -->
<insert id="insertCmmnResource" parameterType="org.flowable.cmmn.engine.impl.persistence.entity.CmmnResourceEntityImpl">
insert into ${prefix}ACT_CMMN_RE_DEPLOYMENT_RESOURCE(ID_, NAME_, RESOURCE_BYTES_, DEPLOYMENT_ID_)
insert into ${prefix}ACT_CMMN_DEPLOYMENT_RESOURCE(ID_, NAME_, RESOURCE_BYTES_, DEPLOYMENT_ID_)
values (#{id, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{bytes, jdbcType=${blobType}}, #{deploymentId, jdbcType=VARCHAR})
</insert>
<insert id="bulkCmmnInsertResource" parameterType="java.util.List">
INSERT INTO ${prefix}ACT_CMMN_RE_DEPLOYMENT_RESOURCE(ID_, NAME_, RESOURCE_BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES
INSERT INTO ${prefix}ACT_CMMN_DEPLOYMENT_RESOURCE(ID_, NAME_, RESOURCE_BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES
<foreach collection="list" item="resource" index="index" separator=",">
(#{resource.id, jdbcType=VARCHAR},
#{resource.name, jdbcType=VARCHAR},
......@@ -25,7 +25,7 @@
<insert id="bulkCmmnInsertResource" databaseId="oracle" parameterType="java.util.List">
INSERT ALL
<foreach collection="list" item="resource" index="index">
INTO ${prefix}ACT_CMMN_RE_DEPLOYMENT_RESOURCE(ID_, NAME_, RESOURCE_BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES
INTO ${prefix}ACT_CMMN_DEPLOYMENT_RESOURCE(ID_, NAME_, RESOURCE_BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES
(#{resource.id, jdbcType=VARCHAR},
#{resource.name, jdbcType=VARCHAR},
#{resource.bytes, jdbcType=${blobType}},
......@@ -38,7 +38,7 @@
<!-- RESOURCE DELETE -->
<delete id="deleteCmmnResourcesByDeploymentId" parameterType="string">
delete from ${prefix}ACT_CMMN_RE_DEPLOYMENT_RESOURCE where DEPLOYMENT_ID_ = #{id}
delete from ${prefix}ACT_CMMN_DEPLOYMENT_RESOURCE where DEPLOYMENT_ID_ = #{id}
</delete>
<!-- RESOURCE RESULTMAP -->
......@@ -52,17 +52,17 @@
<!-- RESOURCE SELECT -->
<select id="selectCmmnResourceNamesByDeploymentId" parameterType="org.flowable.engine.common.impl.db.ListQueryParameterObject" resultType="string">
select NAME_ from ${prefix}ACT_CMMN_RE_DEPLOYMENT_RESOURCE where DEPLOYMENT_ID_ = #{parameter} order by NAME_ asc
select NAME_ from ${prefix}ACT_CMMN_DEPLOYMENT_RESOURCE where DEPLOYMENT_ID_ = #{parameter} order by NAME_ asc
</select>
<select id="selectCmmnResourceByDeploymentIdAndResourceName" parameterType="map" resultMap="cmmnResourceResultMap">
select * from ${prefix}ACT_CMMN_RE_DEPLOYMENT_RESOURCE
select * from ${prefix}ACT_CMMN_DEPLOYMENT_RESOURCE
where DEPLOYMENT_ID_ = #{deploymentId}
AND NAME_ = #{resourceName}
</select>
<select id="selectCmmnResourcesByDeploymentId" parameterType="org.flowable.engine.common.impl.db.ListQueryParameterObject" resultMap="cmmnResourceResultMap">
select * from ${prefix}ACT_CMMN_RE_DEPLOYMENT_RESOURCE where DEPLOYMENT_ID_ = #{parameter} order by NAME_ asc
select * from ${prefix}ACT_CMMN_DEPLOYMENT_RESOURCE where DEPLOYMENT_ID_ = #{parameter} order by NAME_ asc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册