Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java HQL:未找到命名参数,即使它存在_Java_Hibernate_Hql - Fatal编程技术网

Java HQL:未找到命名参数,即使它存在

Java HQL:未找到命名参数,即使它存在,java,hibernate,hql,Java,Hibernate,Hql,我收到异常,无法找到命名参数,即使它存在 org.hibernate.QueryParameterException: could not locate named parameter [type] 质疑 我根本不明白问题出在哪里。您的查询缺少括号和value关键字 试一试 不是重复的@Andremoniy,只是打字错误 String query = ("insert into my_table (abc_id, dup_id,type_code) "+

我收到异常,无法找到命名参数,即使它存在

org.hibernate.QueryParameterException: could not locate named parameter [type]
质疑


我根本不明白问题出在哪里。

您的查询缺少括号和
value
关键字

试一试


不是重复的@Andremoniy,只是打字错误
String query = ("insert into my_table (abc_id, dup_id,type_code) "+
                     " (abc_seq.nextval, 2,:type");
            Query myQuery = em.createNativeQuery(query);    
            nativeQuery.setParameter("type", code);
String query = ("insert into my_table (abc_id, dup_id,type_code) "+
                "values (abc_seq.nextval, 2,:type)");
Query myQuery = em.createNativeQuery(query);    
nativeQuery.setParameter("type", code);