`
zeng1990
  • 浏览: 51450 次
  • 性别: 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.

    Ionic日期选择插件

    感谢gocaizi贡献出来的代码,我在此基础上进行了一些修改 http://blog.csdn.net/u013276665/article/details/50001083

    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与上位机RS232通讯接口子程序

    Business Intelligence and the Cloud(Wiley,2014)

    It starts with a discussion of the media hype around cloud computing and attempt to pull together what industry experts are saying in order to create a unified definition. Once this foundation is ...

    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报错解决方法[归纳].pdf

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

    Economics_10E

    more money in an attempt to stimulate a flagging economy. And there is uncertainty about fiscal policy as a trillion dollar deficit interacts with an aging population to create a national debt time ...

    Programming with GNU software 2

    This book is neither a...attempt to guide you through the process of choosing, configuring and using GNU tools. We will do this by developing an example project demonstrating the actual use of each tool.

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

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

    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