有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何使用Liquibase Hibernate插件配置主键名的长度

我正在使用Liquibase Hibernate插件生成从实体类到数据库的diffChangeLog

我遇到的一个问题是Liquibase为主键生成的名称太短

例如,我有两张桌子

不明嫌犯模板 和 不明嫌犯模板物品

生成的变更集分别是

<changeSet author="rince(generated)" id="1405359138759-50">
        <createTable tableName="unsub_template">
            <column autoIncrement="true" name="id" type="BIGINT">
                <constraints primaryKey="true" primaryKeyName="unsub_templatPK"/>
            </column>

<changeSet author="rince(generated)" id="1405359138759-51">
        <createTable tableName="unsub_template_item">
            <column autoIncrement="true" name="id" type="BIGINT">
                <constraints primaryKey="true" primaryKeyName="unsub_templatPK"/>
            </column>

注意primaryKeyName属性都是15个字符长的unsub_templatPK

我做了一些调试,发现长度为org.hibernate.mapping.PersistentClass的原因。这里定义了一个静态字段PK_ALIAS

private static final Alias PK_ALIAS = new Alias(15, "PK");

有没有办法配置PK_别名


共 (0) 个答案