将hbm映射为@mappedclass注释的继承

时间:2012-04-10 07:35:31

标签: hibernate inheritance hbm

我正在使用hbm文件(保持纯pojo类没有注释),我想使用带有技术信息(id,创建/修改日期和用户)的超类作为@mappedclass注释。

<hibernate-mapping>
<class name="AbstractEntity" abstract="true">
    <id name="entityId"></id>
    <!-- Id overridé dans les classes filles -->
    <property name="userCreation" type="string">
        <column name="USR_LOG_I" length="20" not-null="true" />
    </property>
    <property name="dateCreation" type="timestamp">
        <column name="DTE_LOG_I" length="26" not-null="true" />
    </property>
    <property name="userModification" type="string">
        <column name="USR_LOG_U" length="20" not-null="true" />
    </property>
    <property name="dateModification" type="timestamp">
        <column name="DTE_LOG_U" length="26" not-null="true" />
    </property>
    <property name="audit" type="string">
        <column name="AUDIT" length="10" />
    </property>
</class>

如何在子中声明抽象继承?有可能??

hibernate-mapping>
<class name="FilleEntity" table="MA_TABLE">.......

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

也许这就是你要找的东西:

<class name="FilleEntity" table="MA_TABLE">
    <meta attribute="extends">AbstractEntity</meta>