如何映射(NHibernate)指定的PostgreSql类型?

发布于 2024-07-23 06:05:07 字数 590 浏览 2 评论 0原文

我有一个 PK(角色(10)),映射如下:

负载在 npgsql 1.0 上工作正常,使用 loadbyid 生成的 sql 是:

从“tblCity”city0_ WHERE 中选择 city0_."IDCity" 作为 IDMu1_92_0_ city0_."IDCity"=E'BR420240'

使用 npgsql 2.0。 生成的 SQL 为:

SELECT city0_."IDCity" as IDMu1_92_0_ FROM "tblCity" city0_ WHERE city0_."IDCity"='BR420240'::text

所以,我得到了 ObjectNotFoundException,因为 SQL 返回 0 结果...

Npgsql 开发人员告诉我指定 PK 的确切类型,其中 case : 字符(10)...

我如何使用 NH 来做到这一点? 我尝试使用sql-type,但我认为它只是 存在于 Hibernate 中...

谢谢

I have a PK (character (10)), that is mapped like that:

The load works fine with npgsql 1.0, the sql generated with loadbyid
is :

SELECT city0_."IDCity" as IDMu1_92_0_ FROM "tblCity" city0_ WHERE
city0_."IDCity"=E'BR420240'

Using npgsql 2.0. the sql generated is :

SELECT city0_."IDCity" as IDMu1_92_0_ FROM "tblCity" city0_ WHERE
city0_."IDCity"='BR420240'::text

So, I got ObjectNotFoundException, because that SQL returns 0
results...

Npgsql developer told-me to specify the exact type to the PK, in that
case : character(10)...

How can I do that using NH? I tried use sql-type, but I think it only
exist in Hibernate...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲念泪 2024-07-30 06:05:07

这是一个 NHibernate 错误...

It is a NHibernate bug...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文