【发布时间】:2015-01-14 05:51:32
【问题描述】:
我遇到了休眠 xml 映射的问题。我想在现有的数据库架构中添加一个新字段“newField”。
我想在另一个之后插入此字段(示例中为大小),并且成为多列唯一键约束的一部分。
xml映射如下:
<hibernate-mapping default-lazy="false" default-cascade="all" package="xxx">
<class name="A" table="As" discriminator-value="a">
<id name="dbId" column="db_id" type="long">
<generator class="IdentityGenerator"/>
</id>
<discriminator column="tag" type="string"/>
<property name="created" type="timestamp" insert="false" update="false" generated="insert"/>
<properties name="key" unique="true">
<property name="name" column="name" type="string" not-null="true"/>
<property name="version" column="version" length="80" type="string"/>
</properties>
<property name="size" column="size" type="long"/>
<property name="newField" column="new_field" type="long"/>
</class>
如果我将新字段的属性添加到多列“属性”中,它将被创建两次。
你知道hibernate有没有办法做到这一点?
感谢您的帮助
乔里斯
【问题讨论】:
标签: java xml hibernate mapping key