hibernate 4.1之后对于HQL中查询参数的占位符做了改进,如果仍然用老式的占位符会有类似如下的告警信息:
[main] WARN [org.hibernate.hql.internal.ast.HqlSqlWalker] – [DEPRECATION] Encountered positional parameter near line 1, column 95. Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
从告警提示信息中可以看出,它建议用命名参数或者JPA占位符两中种方法来代替老的占位符查询方法。
比如老的占位符查询代码片段:
1
|
String
hql = "select
t from Blog t where t.site=? " ;
|
2
|
Query
query = getSession().createQuery(hql);
|
3
|
query.setParameter( 0 , "micmiu.com" );
|
方法一:改成命名参数的方式:
2
|
String
hql2 = "select
t from Blog t where t.site=:site " ;
|
3
|
Query
query2 = getSession().createQuery(hql2);
|
4
|
query2.setParameter( "site" , "micmiu.com" );
|
方法二:改成JPA占位符的方式:
2
|
String
hql3 = "select
t from Blog t where t.site=?0 " ;
|
3
|
Query
query3 = getSession().createQuery(hql3);
|
4
|
query2.setParameter( "0" , "micmiu.com" );
|
后面两种查询方法就不会有告警信息产生了。
分享到:
相关推荐
集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...
tensorstensorstensors
光丝诱导荧光分辨丙醇分子位置异构体,魏祥野,涂志伟,本文实验展示了利用高强度飞秒激光光丝非线线荧光光谱法分辨丙醇分子位置异构体。通过测量光丝激发正丙醇与异丙醇分子的特征荧光
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
使用方法:usage: yapf [-h] [--style STYLE] [-d | -i] [-l START-END | -r] ... Formatter for Python code. positional arguments: files optional arguments: -h, --help ...
重新思考位置编码_Rethinking Positional Encoding.pdf
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
1D,2D和3D正弦波位置编码喷灯 这是1D,2D和3D正弦位置编码的实现,能够在(batchsize, x, ch) , ... pip install positional-encodings 具体地说,用于插入位置编码的公式如下: 1D: PE(x,2i) = sin(x/10000^
Transformer之Positional encoding
It is mostly SVR4 compatible although it has some extensions (for example, handling more than 9 positional parameters to macros). GNU m4 also has built-in functions for including files, running shell...
html5rocks webaudio 教程演示的副本: ://www.html5rocks.com/en/tutorials/webaudio/positional_audio/ 安装 克隆并 cd 到 repo npm install -g cordova cordova platforms add browser cordova run browser 在...
运⾏后会输出: lisi ('san',) Hello World {'py': 'good'} 它有四种参数: first是定位参数,positional parameter,不可省略。 *args是可变参数,arguments,存⼊元组。 second是默认值参数,default argument ...
The command is evaluated through /bin/sh and any arguments after it are passed through as shell positional parameters. -p: show project headers before output of the specified command. This is ...
add_atr() takes 0 positional arguments but 1 was given Request Method: GET Request URL: http://127.0.0.1:8000/add_stu/ Django Version: 3.0.3 Exception Type: TypeError Exception Value: add_atr() takes ...
positional arguments: path The file or folder to share optional arguments: -h, --help show this help message and exit -p, --pin Pin target to a remote node or cluster --no-clipboard Disable ...
positional arguments: The pattern files to apply (eg when not using the built-in ones or additional ones). named arguments: -h, --help show this help message and exit --dir The input directory with ...
NULL 博文链接:https://caohong286.iteye.com/blog/1485710
It aims to be easy to use and concise yet powerful and robust. Overview Defining options and positional arguments is as simple as: import com.xenomachina.argparser.ArgParser class MyArgs(parser: ...
Positional是基于位置的应用程序,它利用手机的GPS硬件,并获取当前纬度和经度数据的各种详细信息,例如海拔,速度,地址和其他类似信息,并以易于理解的格式向用户显示。 除了作为定位应用程序的主要功能外,...
博弈论与数学的完美结合,幽默又不失严谨性。