I have a Java project where I call a stored procedure using hibernate.
我有一个Java项目,我使用hibernate调用存储过程。
Here is sample code I am using
这是我正在使用的示例代码
public String findCloudName(Long cloudId) {
LOG.info("Entered findCloudName Method - cloudId:{}", cloudId);
String cloudName = null;
ProcedureCall procedureCall = currentSession().createStoredProcedureCall("p_getCloudDetails");
procedureCall.registerParameter( "cloudId", Long.class, ParameterMode.IN ).bindValue( cloudId );
procedureCall.registerParameter( "cloudName", String.class, ParameterMode.OUT );
ProcedureOutputs outputs = procedureCall.getOutputs();
cloudName = (String) outputs.getOutputParameterValue( "cloudName" );
LOG.info("Exiting findCloudName Method - cloudName:{}", cloudName);
return cloudName;
}
This works fine and results the expected results. However It leaves the following message in my logs
这很好,并产生预期的结果。但是它在我的日志中留下以下消息
[WARN] [320]org.hibernate.procedure.internal.ProcedureCallImpl[prepareForNamedParameters] - HHH000456: Named parameters are used for a callable statement, but database metadata indicates named parameters are not supported.
I was looking through websites and the source code of hibernate to try and figure out how to get rid of this warning
我正在浏览网站和hibernate的源代码,试图找出如何摆脱这个警告
Any help is greatly appreciated
任何帮助是极大的赞赏
Cheers Damien
1 个解决方案
#1
It's related to the correction of HHH-8740 :
这与HHH-8740的校正有关:
In some cases, the database metadata is incorrect (i.e., says something is not supported, when it actually is supported). In this case it would be preferable to simply log a warning. If it turns out that named parameters really are not supported, then a SQLException will be thrown later when the named parameter is bound to the SQL statement.
在某些情况下,数据库元数据不正确(即,当实际支持时,表示不支持某些内容)。在这种情况下,最好只记录一个警告。如果事实证明命名参数确实不受支持,那么当命名参数绑定到SQL语句时,将抛出SQLException。
So, the warning warn you from calling a method that queries metadata on named parameters.
因此,警告警告您调用查询命名参数元数据的方法。
#1
It's related to the correction of HHH-8740 :
这与HHH-8740的校正有关:
In some cases, the database metadata is incorrect (i.e., says something is not supported, when it actually is supported). In this case it would be preferable to simply log a warning. If it turns out that named parameters really are not supported, then a SQLException will be thrown later when the named parameter is bound to the SQL statement.
在某些情况下,数据库元数据不正确(即,当实际支持时,表示不支持某些内容)。在这种情况下,最好只记录一个警告。如果事实证明命名参数确实不受支持,那么当命名参数绑定到SQL语句时,将抛出SQLException。
So, the warning warn you from calling a method that queries metadata on named parameters.
因此,警告警告您调用查询命名参数元数据的方法。