在NHibernate中引导Id时无法从Oracle加载 [英] Can't load from Oracle when Id is Guid in NHibernate

查看:68
本文介绍了在NHibernate中引导Id时无法从Oracle加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将一个对象保存到NHibernate,在其中将Id键入Guid.根据其他发现,我们将其作为char(36)类型.

We're saving an object to NHibernate where the Id is typed Guid. Based on other things we've found we have this as a type char(36).

  • 我们创建一个对象,并通过NHibernate将其保存.这可以正常工作,我们在列中看到64599239BB0C1C48B44C36D9F9267830.
  • 当我们尝试使用Guid进行加载时,我们没有得到任何结果,NHibernate Profiler显示WHERE子句正在查找不匹配的0x64599239BB0C1C48B44C36D9F9267830.
  • We create an object and save it via NHibernate. This works fine and we see 64599239BB0C1C48B44C36D9F9267830 in the column.
  • When we then try to load using a guid we don't get any results and NHibernate Profiler shows that the WHERE clause is looking for 0x64599239BB0C1C48B44C36D9F9267830 which isn't matching.

很明显,我们在做错事...

Obviously we're doing something wrong.. so any ideas what?

推荐答案

数据库上的数据类型应为RAW,且长度为16.这就是尝试使用NHibernate生成数据库的方法.

The data type on the database should be RAW, and of 16 length. This is what trying to recreate the database using NHibernate produces.

这篇关于在NHibernate中引导Id时无法从Oracle加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆