`
zeng1990
  • 浏览: 52279 次
  • 性别: Icon_minigender_1
  • 来自: 桂林
社区版块
存档分类
最新评论

关于attempt to create delete event with null entity的异常

    博客分类:
  • ssh
阅读更多
在做spring和hibernate整合的时候,删除实体时有时经常报java.lang.IllegalArgumentException: attempt to create delete event with null entity这样的错误,今天用junit4做测试删除的时候报了这个错误,感谢网友的帮忙,终于解决。
解决办法是:

@Test
	public void deleteUser()
	{
		UserService us = (UserService) ac.getBean("userService");
		User user = us.get(1);
		us.delete(user);
	}

改成:
@Test
	public void deleteUser()
	{
		UserService us = (UserService) ac.getBean("userService");
		User user = null;
		if ((user = us.get(1)) != null)
		{
			us.delete(user);
		}

	}

分享到:
评论

相关推荐

    VclZip pro v3.10.1

    Modified the SFX code (the code used to create the SFX stub distributed with VCLZip) so that it handles filenames that have been run through an OEM Conversion. The SFX was losing accented characters. ...

    A Practical Guide to Designing with Data.pdf

    Over the years, I have been digging through large data sets both for work and pleasure. I love numbers, charts, graphs, visualizations, ...and visualizations become easier to create.

    An attempt to read, understand, and implement the AUTOSAR SWS Po

    An attempt to read, understand, and implement the AUTOSAR SWS Port Driver according to the specification in a demo full-layered AUTOSAR a…

    Ionic日期选择插件

    在提供的链接中,可以找到关于这个插件的详细信息和使用教程。 该插件可能提供了以下功能: 1. 用户友好的界面:提供一个易于使用的日期选择器,使用户能够方便地选择日期,可能包括日、月、年选择。 2. 自定义配置...

    Easy Mobile

    Easy Mobile is our attempt to create a many-in-one Unity package that greatly simplifies the implementation of de facto standard features of mobile games including advertising, in-app purchasing, game...

    AT89C2051 RS232

    AT89C2051是一款8位微控制器,由美国Atmel公司生产,属于8051系列的单片机。它具有低功耗、高性能的特点,适用于各种嵌入式应用,包括工业控制、消费电子和家用电器等。RS232,则是一种常见的串行通信接口标准,用于...

    orcad15.7 破解方法

    orcad15.7 安装问题解决:An application has made an attempt to load the C runtime library incorrectly. Please ccontact the application"s support team for more information!

    Android代码-HeaderFooterGridView

    HeaderFooterGridView 头尾GridView 源码地址:ProjectX 介绍 支持AUTO_FIT模式,头尾模式有两种,无反射代码。 截图 先决条件 minSdkVersion 4 ...hfgContent.addHeaderItem(headerItem, null, true); hfgCont

    Pro LINQ: Language Integrated Query in C# 2010 (含源码)

    How to query Databases with LINQ to SQL, write your own entity classes, and understand how to handle concurrency conflicts. Who this book is for This book is written for the proficient C# developer, ...

    mksysb报错解决方法[归纳].pdf

    《mksysb报错解决方法的详细指南》 在软件开发过程中,系统备份是确保数据安全和系统稳定性的重要步骤。然而,有时在执行mksysb命令进行系统备份时,可能会遇到各种报错,这可能对系统的正常运行造成影响。...

    smoke dx10 Copyright 2007 NVIDIA Corporation

    IN NO EVENT SHALL NVIDIA扴 AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE ...

    pb双击打开错误方式的修复

    PB,全称PowerBuilder,是一种流行的面向对象的编程环境,主要用于开发企业级应用程序,特别是数据库应用。当你在尝试双击打开PB项目时遇到错误,这可能是由于多种原因引起的,包括注册表问题、软件版本不兼容、环境...

    企业进销存管理系统 系统开发

    主要功能 进销存管理是企业日常经营管理中十分重要的一个组成部分,传统的手工管理方式呈现出越来越多的弊端。在手工管理模式下,统计、汇总处理时的工作量极其繁重,处理效率非常低,领导也无法及时了解企业资金...

    Test Driven Development with Python 2nd Edition.pdf

    This book is my attempt to share with the world the journey I’ve taken from “hack‐ ing” to “software engineering”. It’s mainly about testing, but there’s a lot more to it, as you’ll soon see....

    Winlicense v2.0.6.0

    * Possibility to create Trial versions with multiple different expiration types like: expiration by days, by executions, by specific date, by minutes, by runtime, etc. * Possibility to extend the ...

    KafkaOffsetMonitor监控工具2017年1月发布的版本

    Created function tryParseOffsetMessage to attempt to parse a kafka offset message retrieved from the internal committed offset topic: Handles messages of other types and questionable correctness. ...

Global site tag (gtag.js) - Google Analytics