`
mr.shang
  • 浏览: 38741 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ids for this class must be manually assigned

阅读更多

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():

异常原因:
<id>元素配置不正确,<id>元素缺少其子元素<generator></generator>的配置。
解决方法:
<id>元素映射了相应数据库表的主键字段,对其子元素<generator class="">,其中class的取值可以为increment、identity、sequence、hilo、native……等,更多的可参考hibernate参考文档,一般取其值为native 功能是适应本地数据库。

exp:

<hibernate-mapping>
    <class name="com.fqf.Vipdata" table="vipdata" catalog="test">
        <id name="vipId" type="java.lang.Integer">
            <column name="vipId" />
            <generator class="assigned" />
        </id>
        <property name="vipName" type="java.lang.String">
            <column name="vipName" length="20" not-null="true" />
        </property>
        <property name="vipTitle" type="java.lang.String">
            <column name="vipTitle" length="20" not-null="true" />
        </property>
    </class>
</hibernate-mapping>

看看数据库表中的 id 是不是自增长类型,把<generator class="assigned" />中assigned改为increment

(vipId的类型为自增长)

分享到:
评论
1 楼 friendmonk 2009-03-09  
但是,当不写<generator />时默认的就是assigned吧

相关推荐

    dev_ids.tsv

    glue_data的MRPC数据集映射文件

    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 回调函数

    'manually and everything should be set for your client app to call the server through 'OLE. 'Note6: Every time you build a new exe of your server, VB will generate a new 'unique ID for each of its ...

    DevExpress VCL_18.2.5.part2,包含XE10.3.1下的快速安装项目文件

    XE10.3.1 安装方法: 1、打开XE,在菜单Tools\Options对话框中的Environment Options\Delphi Options\Library中添加“【下载包解压目录】\Sources”; 2、打开DevExpress VCL RS26工程包,在Project Manager窗口中...

    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 ...

    ULPBench - Beyond the Data Sheets of Ultra-Low-Power MCU.pdf

    Note: the USB driver must be manually installed because the USB driver is not recognized by the PC. The appropriate drivers are located in the /bin/USB_CDC folder. Connect the terminals +3 V (VCC) ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    For this reason, the functions that handle these actions offer the option of waiting until the action is complete before returning (so-called synchronous operation); although they can be called in an ...

    网络修复winsrepair

    1) The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 2) You must not alter the software, user license or installer in any way. 3) This ...

    Json NET 6 0 R8 For NET 2 0 4 5

    or the JSON is radically different from your class and you need to manually read and write from your objects."&gt;Json.NET is a popular high-performance JSON framework for .NET Features Flexible JSON ...

    Test Sequencing in Complex Manufacturing Systems

    be executed in what sequence to ensure in the shortest possible test time that the system works, which is the test-sequencing problem, was already solved by Pattipati et al. for the diagnosis of ...

    unidac 5.3.10

    Versions of UniDAC with Source Code must be installed manually. For more information, see the Installation topic of the UniDAC Help documentation. It is important to know that UniDAC, ODAC, SDAC, ...

    A Reinforcement Learning Framework for Medical Image Segmentation.pdf

    this way can be used as valuable knowledge to fill a Q-matrix. The reinforcement learning agent can use this knowledge for similar ultrasound images as well. The results demonstrate high potential for...

    selenium-dotnet-2.45.0.zip

    From this point forward, users are expected to manually install the SafariDriver extension into their Safari installation in order to drive the browser. This is due to Apple's changes in ...

    Json.NET 6.0 R3 For.NET(2.0-4.5)

    LINQ to JSON is good for situations where you are only interested in getting values from JSON, you don't have a class to serialize or deserialize to, or the JSON is radically different from your class...

    Production Testing of RF and System-on-a-Chip Devices for Wireless Communications((Artech.House.Publishers.Apr.2004)

    The intention is for this chapter to be useful to managers, sales teams, and applications engineers who go beyond the role of sitting behind the tester. Also presented in this chapter is a discussion ...

    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 ...

    Device Console (DevCon) Tool_01_源码修正编译通过,VS2013可调试.rar

    DevCon.exe 安装驱动的工具,微软官方源码。 修正编译通过,VS2013可调试 Device Console Help: devcon.exe [-r] [-m:\\] ...dp_enum Lists the third-party (OEM) driver packages installed on this machine.

    英文原版-Instant PHP Web Scraping 1st Edition

    Harvesting and processing this data can be a time consuming task if done manually. However, web scraping can provide the tools and framework to accomplish this with the click of a button. It’s no ...

    Deep Learning with Python-A Hands-on Introduction

    It must be noted that the formal definitions of such rules were done manually. However, such early AI systems were fairly general purpose task/problem solvers in the sense that any problem that could ...

    Human Face Detection in Visual Scenes

    examples, which must be chosen to span the entire space of non-face images. Comparisons with other state-of-the-art face detection systems are presented; our system has better performance in terms of ...

Global site tag (gtag.js) - Google Analytics