流畅的 nHibernate 和列函数 (Oracle)
我有以下 sql:
select s.status_code_id, -- number(2)
s.status.getStringVal(), --sys.xmltype
s.description.getStringVal() --sys.xmltype
from schema2.table_status_code s
Tablestatuscode 表的 Fluent nHibernate 映射是
Table("table_status_code");
Schema("schema2");
Id(x => x.Id)
.Column("STATUS_CODE_ID");
Map(x => x.Status)
.Column("STATUS.getStringVal()");
Map(x => x.Description)
.Column("Description.getStringVal()");
这不起作用。如何在 Fluent nHibernate 中使用 getStringVal() 函数?
这也不起作用:
Table("table_status_code");
Schema("schema2");
Id(x => x.Id)
.Column("STATUS_CODE_ID");
Map(x => x.Status)
.Formula("STATUS.getStringVal()");
Map(x => x.Description)
.Formula("Description.getStringVal()");
HasMany(x => x.Evoluties)
.Inverse();
因为生成的 sql 对于 Oracle 来说不正确。 Oracle 中必须有 tablename.columnname.getStringVal() 而不是 columnname.getStringVal()
谢谢,
Filip
I've got the following sql:
select s.status_code_id, -- number(2)
s.status.getStringVal(), --sys.xmltype
s.description.getStringVal() --sys.xmltype
from schema2.table_status_code s
The Fluent nHibernate map for the tablestatuscode table is
Table("table_status_code");
Schema("schema2");
Id(x => x.Id)
.Column("STATUS_CODE_ID");
Map(x => x.Status)
.Column("STATUS.getStringVal()");
Map(x => x.Description)
.Column("Description.getStringVal()");
This doens't work. How can I use the getStringVal() function with Fluent nHibernate?
This doesn't work either:
Table("table_status_code");
Schema("schema2");
Id(x => x.Id)
.Column("STATUS_CODE_ID");
Map(x => x.Status)
.Formula("STATUS.getStringVal()");
Map(x => x.Description)
.Formula("Description.getStringVal()");
HasMany(x => x.Evoluties)
.Inverse();
because the generated sql isn't correct for oracle. You must have tablename.columnname.getStringVal() in Oracle and not columnname.getStringVal()
thanks,
Filip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 Oracle 不熟悉,但在这种情况下你不能使用自定义 UserType 吗?
http://nhibernate.info/doc/nh/en/ index.html#mapping-types-custom
信息:
示例
config Fluent nhibernate
我发现这个用于 xml 相关的 IUserType 实现:
http://ayende.com/Blog/archive/2006/05/30/NHibernateAndXMLColumnTypes.aspx
http://kaypress.kayrin.com/?p=239
I'm not familiar with Oracle but can't you use a custom UserType in this situation?
http://nhibernate.info/doc/nh/en/index.html#mapping-types-custom
info:
examples
config fluent nhibernate
and I found this for xml related IUserType implementations:
http://ayende.com/Blog/archive/2006/05/30/NHibernateAndXMLColumnTypes.aspx
http://kaypress.kayrin.com/?p=239