`
alyouge
  • 浏览: 191011 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

ids for this class must be manually assigned before calling save() composite-id

阅读更多
hibernate  composite-id 存储的售后一定要指明ID



例如 

[code="xml"]

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="com.model.entity.AcctUserRole" table="ACCT_USER_ROLE" schema="MODEL">
        <composite-id name="id" class="com.model.entity.AcctUserRoleId">
            <key-many-to-one name="acctUser" class="com.model.entity.AcctUser">
                <column name="USER_ID" precision="9" scale="0" />
            </key-many-to-one>
            <key-many-to-one name="acctRole" class="com.model.entity.AcctRole">
                <column name="ROLE_ID" precision="9" scale="0" />
            </key-many-to-one>
        </composite-id>
        <many-to-one name="acctUser" class="com.model.entity.AcctUser" update="false" insert="false" fetch="select">
            <column name="USER_ID" precision="9" scale="0" not-null="true" />
        </many-to-one>
        <many-to-one name="acctRole" class="com.model.entity.AcctRole" update="false" insert="false" fetch="select">
            <column name="ROLE_ID" precision="9" scale="0" not-null="true" />
        </many-to-one>
    </class>
</hibernate-mapping>




AcctUserRole 需要保存的时候

调用如下

AcctUserRole aur = new AcctUserRole();
AcctUserRoleId auri = new AcctUserRoleId();
AcctRole ar = new AcctRole();
ar.setId(id_);
auri.setAcctRole(ar);
auri.setAcctUser(entity);
aur.setId(auri);
acctUserRoleDAO.save(aur);
分享到:
评论

相关推荐

    qt动态场景源码

    qt的动态场景实现源码,基于c++实现,可以作为很好的学习参考

    win 3.11 for workgroup tcpip支持

    RELEASE NOTES FOR MICROSOFT(R) TCP/IP-32 FOR WINDOWS(TM) FOR WORKGROUPS 3.11 PLEASE READ THIS ENTIRE DOCUMENT General ------- This product is compatible with, and supported exclusively on, the ...

    Diskeeper 2008 v12.0.759.0

    Note that Windows 2000 systems must be running Service Pack 3 or higher. The Windows versions supported vary by Diskeeper edition. See the Table of Supported Operating Systems later in this ...

    acpi控制笔记本风扇转速

    ACPI_OPERAND_OBJECT has been manually optimized to be aligned and will not work if it is byte-packed. Example Code and Data Size: These are the sizes for the OS- independent acpica.lib produced by ...

    EurekaLog_7.5.0.0_Enterprise

    This also reduces memory footprint for ecc32/emake 8)....Added: Showing call stacks for 2 new types of fatal memory errors 9)....Added: EMemLeaks._ReserveOutOfMemory to control reserve size of out of...

    macOS Unlocker 2.1 for VMware Workstation 11/12/14(VM14破解补丁)

    You will have to manually mount the darwin.iso for example on Workstation 11 and Player 7. The vmwarebase code does not need to be patched on macOS or ESXi so you will see a message on those systems ...

    Android代码-react-native-ble-manager

    npm i --save react-native-ble-manager After installing, you need to link the native library. You can either: Link native library with react-native link, or Link native library manually Both ...

    dwl-g122 b1 c1

    10. Add XP64 & Vista64 drivers for DWL-G122 (rev.C) 11. Add XP64 drivers for DWL-G122 (rev.B) ------------------------------------------------------------------------------------------- Setup Version:...

    EhLib 8.0 Build 8.0.023 Pro Edition FullSource for D7-XE8

    EhLib 8.0 Build 8.0.023 Pro Edition FullSource for D7-XE8 亲测可用,含全部源码及 Demo The Library contains components and classes for Borland Delphi versions 7, 9, Developer Studio 2006, Delphi 2007...

    dev_ids.tsv

    glue_data的MRPC数据集映射文件

    ICS delphixe10源码版

    The origin of this software must not be misrepresented, you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product ...

    apktool documentation

    We must get HTC framework resources before decoding this apk. We pull com.htc.resources.apk from our device and install it $ apktool if com.htc.resources.apk I: Framework installed to: 2.apk Now we ...

    rubygems-master-(1).zip_GEM

    You must have an installation of RubyGems before this update can be applied. See Gem for information on RubyGems (or `ri Gem`) To upgrade to the latest RubyGems, run: $ gem update --system # you ...

    vmware workstation 11 unlock

    The python.exe file must be on the executable PATH. If it is not on PATH please edit win-install.cmd to point to the installation path. 3. Limitations -------------- The Unlocker currently does not...

    ak2新版内核AKAIO1.5

    ak2新版内核 AceKard All-In-One (AK-AIO) v1.5 ... - Third option in "which cheat file to download" box displays the setting window at plugin launch, can be used for future expansion + Uses gelu's...

    2009 达内Unix学习笔记

    id -a root 显示用户所在组的所有组名(如root用户,是所有组的组员) df 查看文件系统,查看数据区 用法 df [-F FSType] [-abeghklntVvZ] [-o FSType 特定选项] [目录 | 块设备 | 资源] df -k 以kbytes显示文件...

    Python For ArcGIS 数据

    After that, the next assignment will be to answer the same question based on monthly species inventory datasets for fi sh and invertebrates.Performing this process manually for one dataset could be ...

    vb写的ole 回调函数

    Since this ID must be the same ID that is also 'registered in the client machine's registry, this constant changing of the ID can 'make keeping the client and the server working together a real chore...

    Unlocker 2.1.1 vmware装最新OSX解锁程序

    You will have to manually mount the darwin.iso for example on Workstation 11 and Player 7. The vmwarebase code does not need to be patched on macOS systems so you will see a message on those systems ...

    BURNINTEST--硬件检测工具

    This was added for specialized serial port hardware that could lockup after several hours of testing. Release 5.3 build 1017 WIN32 release 3 April 2008 - Corrected the Advanced Network test to run...

Global site tag (gtag.js) - Google Analytics