相关疑难解决方法(0)

NHibernate - 错误脱水属性值

我在更新期间提交时收到错误脱水属性值错误.我搜索了它看起来和NHibernate类似:错误脱水属性 - 这到底是什么?唯一的区别是,在提到的问题中,NHibernate抱怨无法解决财产问题

IssuingOffice的值已经存在于数据库中,因此它不能成为引用未保存记录的问题

以下是详细错误.

Test 'Tests.Services.StickerInvoiceServiceTests.update_sticker_info_succeeds' failed:
NHibernate.PropertyValueException : Error dehydrating property value for
Model.StickerInvoice.StickerIssuingOffice
----> NHibernate.TransientObjectException : object references an unsaved transient 
instance - save the transient instance before flushing or set cascade action for the property to something that would make it autosave. Type: Model.IssuingOffice, Entity: Model.IssuingOffice
at NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] …
Run Code Online (Sandbox Code Playgroud)

c# nhibernate

8
推荐指数
2
解决办法
2万
查看次数

流利的NHibernate - IndexOutOfRange

我已阅读所有帖子并知道IndexOutOfRange通常会发生,因为列被引用了两次.但我根据我的映射看不出这是怎么回事.如果配置中的SHOW_SQL为true,我会看到Events表中的Insert ,然后IndexOutOfRangeExceptionRadioButtonQuestions表引用的表.我看不到它试图使用的SQL会产生异常.我尝试使用AutoMapping,现在已经切换到ClassMap这两个类的完全,以尝试缩小问题范围.

public class RadioButtonQuestion : Entity
{
    [Required]
    public virtual Event Event { get; protected internal set; }

    [Required]
    public virtual string GroupIntroText { get; set; }
}

public class Event : Entity
{
    [Required]
    public virtual string Title { get; set; }

    [Required]
    public virtual DateTime EventDate { get; set; }

    public virtual IList<RadioButtonQuestions> RadioButtonQuestions { get; protected internal set; }
}




public class RadioButtonQuestionMap : ClassMap<RadioButtonQuestion>
{
    public RadioButtonQuestionMap() …
Run Code Online (Sandbox Code Playgroud)

nhibernate fluent-nhibernate nhibernate-3 fluent-nhibernate-mapping

5
推荐指数
2
解决办法
5735
查看次数