NHibernate 如何调用带 schema 前缀的 Oracle 存储过程?
我现在有 NHibernate 调用 Oracle 中的存储过程。但是,如何在标记的 {call} 语法中指定架构前缀?
我尝试过,
<sql-query name="my_sproc">
<return class="my_sproc_class" />
{call schema2.my_sproc (:p1)}
</sql-query>
但 NHibernate 运行时返回时未定义“schema2”,而“schema2”是我的 Oracle 数据库上明确定义的架构。
谢谢。
I have NHibernate calling stored procedure in Oracle working currently. However, how do I specify a schema prefix in the {call} syntax in the tag?
I tried
<sql-query name="my_sproc">
<return class="my_sproc_class" />
{call schema2.my_sproc (:p1)}
</sql-query>
But NHibernate run-time came back with 'schema2' not defined while 'schema2' is a definitely defined schema on my Oracle db.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
难道是特权?该过程可能存在于该架构中,但您可能没有执行它的权限,或者您可能通过未启用的角色拥有权限。
可能是参数。如果该过程需要两个参数(或者是一个函数),那么尝试用一个参数调用它可能会出现“不存在”错误,而实际上它意味着“我无法仅用一个参数调用它”。
最后一个选项是您的架构中有一个与其他架构同名的包。可能会发生在像“UTILS”这样的通用事物上。如果您要求 Oracle 执行 UTILS.PROC 并且您有一个 UTILS 包,那么它会在该包中查找,如果没有找到它,则抛出一个错误,即使存在带有过程 PROC 的 UTILS 模式。
编辑添加
在这种情况下,我倾向于参数问题
此处的示例似乎使用 ?作为参数占位符。
Could it be privileges ? The procedure may exist in that schema but you may not have privileges to execute it, or you may have privileges through a role that isn't enabled.
Could be parameters. If the procedure expects two parameters (or is a function) then trying to call it with one can get a "Doesn't exist" error when it really means "There isn't one I can call with just one parameter".
Final option is if you have a package in your schema with the same name as the other schema. Can happen with something generic like 'UTILS'. If you ask Oracle to execute UTILS.PROC and you have a UTILS package, then it will look in the package and throw an error if it doesn't find it, even if there is a UTILS schema with a procedure PROC.
Edited to add
In that case, I'm leaning towards a parameters issue
The example here seems to use ? as the parameter placeholder.
我可能在这里弄错了,但我认为 NHibernate 要求所有 UDF/SPROCS 都以“dbo”为前缀;
{call dbo.schema2.my_sproc (:p1)}
有效吗?I could be mistaken here, but I thought that NHibernate requires all UDFs/SPROCS to be prefixed with "dbo"; does
{call dbo.schema2.my_sproc (:p1)}
work?