今天重新看看hibernate基础

<hibernate-mapping>
    <class name="com.hongwei.athena.model.Admin" table="admin">
        <id name="aid" type="java.lang.Integer">
            <column name="aid" />
            <generator class="identity" />
        </id>
        <property name="username" type="java.lang.String">
            <column name="username" length="30" />
        </property>
        <property name="password" type="java.lang.String">
            <column name="password" length="30" />
        </property>
        <property name="realname" type="java.lang.String">
            <column name="realname" length="10" />
        </property>
        <property name="type" type="java.lang.Integer">
            <column name="type">
                <comment>1 超级管理员 2管理员</comment>
            </column>
        </property>
        <property name="status" type="java.lang.Integer">
            <column name="status">
                <comment>1 正常 2冻结</comment>
            </column>
        </property>
        <property name="lastTime" type="java.sql.Timestamp">
            <column name="last_time" length="19" />
        </property>
        <property name="createTime" type="java.sql.Timestamp">
            <column name="create_time" length="19" />
        </property>
        <set name="adminHistories" inverse="true">
            <key>
                <column name="admin_id" />
            </key>
            <one-to-many class="com.hongwei.athena.model.AdminHistory" />
        </set>
    </class>
</hibernate-mapping>

 

 

set是表明了了与其他表之间的关系

一对多的关系多多关系,多对一。

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭