日期:2014-05-18  浏览次数:20773 次

hibernate+spring 插入数据 高手请进
有一个用户表映射如下,其中头像和权限引用外键,同时本表用户的code又被其它表引用
我要怎么才能插入数据 ,望高手指教


XML code

<hibernate-mapping>
    <class name="com.mwgj.wmw.spring.Wmwusertable" table="wmwusertable" lazy="false">
        <id name="wmwUid" type="java.lang.Integer">
            <column name="wmw_uid" />
            <generator class="native"></generator>
        </id>
        <many-to-one name="wmwheadimgtable" class="com.mwgj.wmw.spring.Wmwheadimgtable" fetch="select">
            <column name="wmw_uheadportrait">
                <comment>头像</comment>
            </column>
        </many-to-one>
        <many-to-one name="wmwpopedomtable" class="com.mwgj.wmw.spring.Wmwpopedomtable" fetch="select">
            <column name="wmw_upopedom" not-null="true">
                <comment>权限</comment>
            </column>
        </many-to-one>
        <property name="wmwUcode" type="java.lang.String">
            <column name="wmw_ucode" not-null="true" unique="true">
                <comment>用户code</comment>
            </column>
        </property>
        <property name="wmwUuser" type="java.lang.String">
            <column name="wmw_uuser" length="20" not-null="true">
                <comment>用户名</comment>
            </column>
        </property>
        <property name="wmwUpass" type="java.lang.String">
            <column name="wmw_upass" length="30" not-null="true">
                <comment>密码</comment>
            </column>
        </property>
        <property name="wmwUnickname" type="java.lang.String">
            <column name="wmw_unickname" length="20" not-null="true" unique="true">
                <comment>昵称</comment>
            </column>
        </property>
        <property name="wmwUwisdom" type="java.lang.String">
            <column name="wmw_uwisdom" length="176">
                <comment>名言</comment>
            </column>
        </property>
        <property name="wmwUmail" type="java.lang.String">
            <column name="wmw_umail" length="40" not-null="true" unique="true">
                <comment>邮箱</comment>
            </column>
        </property>
        <property name="wmwUuserinfo" type="java.lang.String">
            <column name="wmw_uuserinfo">
                <comment>用户信息</comment>
            </column>
        </property>
        <property name="wmwUinitpass" type="java.lang.String">
            <column name="wmw_uinitpass" length="30" not-null="true">
                <comment>初始密码</comment>
            </column>
        </property>
        <property name="wmwUregdate" type="java.util.Date">
            <column name="wmw_uregdate" length="0">
                <comment>注册时间</comment>
            </column>
        </property>
        <property name="wmwUlogdate" type="java.util.Date">
            <column name="wmw