java.lang.IllegalArgumentException: Update/delete queries cannot be typed

一:错误写法

String hql =  " delete from T_ST_CircuitMeterInfo e where e.circuitID = ?";

Query query = em.createQuery(hql, T_ST_CircuitMeterInfo.class);

query.setParameter(1, circuitID);

int count =  query.executeUpdate();

二:正解

String hql =  " delete  from T_ST_CircuitMeterInfo e where e.circuitID = ?";

Query query = em.createQuery(hql);

query.setParameter(1, circuitID);

int count =  query.executeUpdate();

delete语句执行createQuery的时候,不能传对象类。

时间: 2024-12-19 22:50:32

java.lang.IllegalArgumentException: Update/delete queries cannot be typed的相关文章

springmvc与mybatis整合时 java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 异常

今天在整合springmvc与mybatis时,启动服务器遇到这样一个问题, by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required at org.springframework.util.Assert.notNull(Assert.java:112) 异常的意思是  缺少sqlSessionFactory 或者是  sqlSessionTe

Hive报错 Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D

报错信息如下 Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D 解决方法: 编辑 hive-site.xml 文件,添加下边的属性 <property> <name>system:java.io.tmpdir<

java.lang.IllegalArgumentException: Illegal character in query at index 261

在BaseFragment中使用了LoadingPage,而LoadingPage的联网加载使用的是AsyncHttpClient.一直报java.lang.IllegalArgumentException: Illegal character in query at index 261解析不成功,改成OkHttp解析即可. 网上有些方法,说先URLEncode再拼接,如果解决不了,换个联网请求方式,试一下.

解决Android studio 启动报错java.lang.RuntimeException: java.lang.IllegalArgumentException

报错内容 Internal error. Please report to https://code.google.com/p/android/issues java.lang.RuntimeException: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'name' of com/android/tools/idea/welcome/Platform.<init> must not be null 

java.lang.IllegalArgumentException: Service not registered

java.lang.IllegalArgumentException: Service not registered 首先检查一下,Service是否在AndroidManifest文件中注册.格式如下: <service   android:name=".MyService"  ></service> 如果Service已经注册了,还是会报这个错误的话,可能是 1.bindService没有成功,就直接unbindService: 2.也可能是已经unbind

java.lang.IllegalArgumentException: XXX is ambiguous in Mapped Statements collection

问题的出现: 在后台添加一个新栏目的时候,照着程序已有原来的代码添加新的功能时,文件没有错误.点击新的栏目的时候报了java.lang.IllegalArgumentException: selectPageByExample is ambiguous in Mapped Statements collection (try using the full name including the namespace, or rename one of the entries). 解决: 在网上查找了

java.lang.IllegalArgumentException: Document base E:\Eclipse\workspace\.metadata\.plugins\org.eclips

1.错误描述 四月 13, 2015 5:56:55 下午 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jdk1.7.0_67\bi

spring整合mybatis遇到的bug java.lang.IllegalArgumentException: Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required

出bug的原因:mybatis-spring版本问题. 查看SqlSessionDaoSupport源码 1.2以上的版本: 1.1.1版本: 解决方法:1.2版本移除了@Autowired的注解,所以如果是1.2版本以上,要在BaseDaoImpl里面手动 注入SetSessionTemplate或者SetSessionFactory spring整合mybatis遇到的bug java.lang.IllegalArgumentException: Property 'sqlSessionFa

BottomSheetBehavior 之 java.lang.IllegalArgumentException: The view is not associated with BottomSheetBehavior

09-14 22:52:58.891 13674-13674/me.chunsheng.uberdriver E/AndroidRuntime: FATAL EXCEPTION: main Process: me.chunsheng.uberdriver, PID: 13674 java.lang.RuntimeException: Unable to start activity ComponentInfo{me.chunsheng.uberdriver/me.chunsheng.uberdr