I have a problem with hibernate xml mapping. I want to add a new field "newField" in an already existing db schema.
I want to insert this field after another (size in the example), AND be part of a multi-column unique key constraint.
The xml mapping is the following:
<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>
If I add the property of my new field into the multi-column "properties", it will be created two times.
Do you know if hibernate has a way to do this ?
Thanks for your help
Joris
No comments:
Post a Comment