开发者

Hibernate - duplicate column name on session.flush

Using hibernate and Hsqldb - a list of objects are sessi开发者_JS百科on.merged through a transaction. When session.flush() is called I get a "duplicate column name in column list: x" where x is the first column.

The database table has no duplicate columns and I am able to read the data allright. The table does contain a composite primary key which I am handling in the mapping file as:

    <composite-id>
        <key-property name="x"></key-property>
        <key-property name="y"></key-property>
    </composite-id>
    <property name="x" type="string" unique="false"
        optimistic-lock="true" lazy="false" generated="never">
        <column name="X" length="10" not-null="true" unique="false" />
    </property>
    <property name="y" type="string" unique="false"
        optimistic-lock="true" lazy="false" generated="never">
        <column name="Y" length="18" not-null="true"
            unique="false" />
    </property>

Thanks


You are mapping the X & Y twice. If you say it is a composite ID there is no need to re-map it as a property.

<composite-id>
    <key-property name="x"></key-property>
    <key-property name="y"></key-property>
</composite-id>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜