<hibernate-mapping>
    <class name="testEntity.MappingMyself" table="MappingMyself">
     <id name="id" type="java.lang.String">
            <column name="MappingMyselfId" length="32" />
            <generator class="uuid.hex" />
        </id>
<property name="name" type="java.lang.String" /> <!--
<many-to-one
name="mappingMyself"
class="testEntity.MappingMyself"
cascade="none"
column="MappingMyselfId"
not-null="false"
/>-->
    </class>
</hibernate-mapping>
实现类似于这样的 自我映射 如何实现呀就是 自己有自己的映射

解决方案 »

  1.   

    applicationContext.xml里面配置上就行了,自我映射?你是想配置自己一对一自己么?
    你要是像不配关系就生成实体表的话只要在配置文件上写好就行了
      

  2.   

      <many-to-one name="MappingMyself" class="com.tianque.bo.MappingMyself" fetch="select">
                <column name="MappingMyselfId" length="32">
                    <comment>...</comment>
                </column>
            </many-to-one>
      

  3.   

     class="com.tianque.bo.MappingMyself"
    这写你自已的路径
      

  4.   

    <column name="MappingMyselfId" length="32">MappingMyselfId  写自已表里面的字断
      

  5.   

    <class name="com.tianque.bo.TSubject" table="T_SUBJECT" >
            <comment>特训科目表</comment>
            <id name="subjectId" type="java.lang.String">
                <column name="SUBJECT_ID" length="32" />
                <generator class="uuid" />
            </id>
            <many-to-one name="TSubject" class="com.tianque.bo.TSubject" fetch="select">
                <column name="PARENT_ID" length="32">
                    <comment>上级科目id</comment>
                </column>
            </many-to-one>
    </class>这是我的你可以看一下