【问题标题】:Mapping hbm for inheritance as @mappedclass annotation映射 hbm 以作为 @mappedclass 注释进行继承
【发布时间】:2012-04-10 07:35:30
【问题描述】:

我正在使用 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">.......

感谢您的帮助!

【问题讨论】:

    标签: hibernate inheritance hbm


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2012-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-07
      • 2011-11-22
      相关资源
      最近更新 更多