今天重新看看hibernate基础

来源:互联网 发布:淘宝第三层级 编辑:程序博客网 时间:2024/04/28 23:53

<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是表明了了与其他表之间的关系

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

原创粉丝点击