我有一個hibernate xml映射問題。我想在現有的數據庫模式中添加一個新字段「newField」。Hibernate XML映射 - 創建新字段並將其添加到多列約束中
我想插入這個字段在另一個(在這個例子中的大小),併成爲一個多列唯一鍵約束的一部分。
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是否有辦法做到這一點?
感謝您的幫助
里斯