开发者

Fluent nHibernate and column functions (Oracle)

I've got the following sql:

select  s.status_code_id, -- number(2)
        s.status.getStringVal(), --sys.xmltype
        s.description.getStringVal() --开发者_C百科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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜