Hi Michael,
Thank you so much for answering! DBMS is MS SQL Server 2008 R2, plain insert on view works, but when you mentioned I'm not sure if returning ID from database server is working - maybe that is the problem - can I customize this feature somehow?. That also makes me wonder, how would NH get inserted ID in case of a Firebird DBMS ? I'm not sure if I should paste entire db code here, I'll see if I can prepare something that makes sense and upload it somewhere with everything else. As for stored procedures, I don't have any issue, I must admit I didn't really even try it with Fluent & NH, I just don't like the way it is supposed to be used. I need client implementation to be as simple and clean as possible. I'm not saying it is bad, I'm just used to much cleaner approach I have setup in Delphi, based on naming conventions of course. That's why I would like to use NH in combination with Fluent conventions based automapping, they are really thrilling in every way except when it comes to stored procedures. NH error details NHibernate.AssertionFailiure == "null identifier" This is Stack Trace, its long... at NHibernate.Engine.EntityKey..ctor(Object identifier, String rootEntityName, String entityName, IType identifierType, Boolean batchLoadable, ISessionFactoryImplementor factory, EntityMode entityMode) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Engine \EntityKey.cs:line 42 at NHibernate.Engine.EntityKey..ctor(Object id, IEntityPersister persister, EntityMode entityMode) in d:\CSharp\NH\NH\nhibernate\src \NHibernate\Engine\EntityKey.cs:line 28 at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in d:\CSharp\NH\NH\nhibernate\src\NHibernate \Event\Default\AbstractSaveEventListener.cs:line 263 at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in d:\CSharp\NH\NH\nhibernate\src\NHibernate \Event\Default\AbstractSaveEventListener.cs:line 187 at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in d:\CSharp\NH\NH\nhibernate\src \NHibernate\Event\Default\AbstractSaveEventListener.cs:line 119 at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\Default \DefaultSaveOrUpdateEventListener.cs:line 162 at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\Default \DefaultSaveOrUpdateEventListener.cs:line 148 at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\Default \DefaultSaveOrUpdateEventListener.cs:line 76 at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\Default \DefaultSaveOrUpdateEventListener.cs:line 53 at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl \SessionImpl.cs:line 2662 at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj) in d:\CSharp \NH\NH\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 541 at DAL_FluentNHibernate.FluentNHibernateEngine.SaveAll[T](IList`1 instances) in C:\Project\WebStartup\DAL_FluentNHibernate \FluentNHibernateEngine.cs:line 56 at UI_WEBFORMS._Default.ASPxButton1_Click(Object sender, EventArgs e) in C:\Project\WebStartup\UI_WEBFORMS\Default.aspx.cs:line 83 at DevExpress.Web.ASPxEditors.ASPxButton.OnClick(EventArgs e) at DevExpress.Web.ASPxEditors.ASPxButton.RaisePostBackEvent(String eventArgument) at DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) On Mar 22, 5:01 pm, Michael Charalambous <[email protected]> wrote: > Hi Sofija > > Both identity and native are post insert generators, so it sounds like > NHibernate is not able to get the newly inserted ID from the database when > updating the view. > > Please can you provide some further information? Ideally the DBMS are you > using, and a failing test showing your scenario including: the table and > view schema, your fluent mapping of the view, test code and the exception. > > Also please can you give the issues you are having with stored procedures > and NHibernate? I've used them to insert data into a legacy database and > found NHibernate works quite well in my scenario. > > Thanks > > Michael > > > > > > > > On Friday, 16 March 2012 23:03:59 UTC, Sofija Blazevski wrote: > > > Hello, everyone! > > > I'm new to NHibernate, and I would like to use it together with > > FluentNHibernate. > > I've been trying to use them together for an updatable view scenario. > > > This is the problem: > > > None of the following Id generator classes > > <generator class="identity" /> > > <generator class="native" /> > > > allows inserting into updatable view. Updatable view (more precisely > > database server) takes care of assigning id. > > Each time I get "Null id" (or is it "Null identifier" ) thrown from > > ISession.SaveOrUpdate method. > > While, on the other hand, same scenario with inserting into table > > works perfectly. > > > On database everything is tested to work. > > NHibernate version is 3.2.0.4000 > > > What is correct way to setup NHibernate to allow inserting into a view > > without providing value for whatever field is set as Id? > > > I would like to use NHibernate for an application with intensive usage > > of views and stored procedures. > > Now, I know you probably don't like usage of updatable views, and I > > would not like to get into discussion on why do I use them, I simply > > need to use them - if I'm gonna use any ORM framework as there is no > > painless way to just use stored procedures (I mean in any ORM in any > > technology I came across so far). > > > Thanks in advance for helping. > > > - Sofija > > On Friday, 16 March 2012 23:03:59 UTC, Sofija Blazevski wrote: > > > Hello, everyone! > > > I'm new to NHibernate, and I would like to use it together with > > FluentNHibernate. > > I've been trying to use them together for an updatable view scenario. > > > This is the problem: > > > None of the following Id generator classes > > <generator class="identity" /> > > <generator class="native" /> > > > allows inserting into updatable view. Updatable view (more precisely > > database server) takes care of assigning id. > > Each time I get "Null id" (or is it "Null identifier" ) thrown from > > ISession.SaveOrUpdate method. > > While, on the other hand, same scenario with inserting into table > > works perfectly. > > > On database everything is tested to work. > > NHibernate version is 3.2.0.4000 > > > What is correct way to setup NHibernate to allow inserting into a view > > without providing value for whatever field is set as Id? > > > I would like to use NHibernate for an application with intensive usage > > of views and stored procedures. > > Now, I know you probably don't like usage of updatable views, and I > > would not like to get into discussion on why do I use them, I simply > > need to use them - if I'm gonna use any ORM framework as there is no > > painless way to just use stored procedures (I mean in any ORM in any > > technology I came across so far). > > > Thanks in advance for helping. > > > - Sofija > > On Friday, 16 March 2012 23:03:59 UTC, Sofija Blazevski wrote: > > > Hello, everyone! > > > I'm new to NHibernate, and I would like to use it together with > > FluentNHibernate. > > I've been trying to use them together for an updatable view scenario. > > > This is the problem: > > > None of the following Id generator classes > > <generator class="identity" /> > > <generator class="native" /> > > > allows inserting into updatable view. Updatable view (more precisely > > database server) takes care of assigning id. > > Each time I get "Null id" (or is it "Null identifier" ) thrown from > > ISession.SaveOrUpdate method. > > While, on the other hand, same scenario with inserting into table > > works perfectly. > > > On database everything is tested to work. > > NHibernate version is 3.2.0.4000 > > > What is correct way to setup NHibernate to allow inserting into a view > > without providing value for whatever field is set as Id? > > > I would like to use NHibernate for an application with intensive usage > > of views and stored procedures. > > Now, I know you probably don't like usage of updatable views, and I > > would not like to get into discussion on why do I use them, I simply > > need to use them - if I'm gonna use any ORM framework as there is no > > painless way to just use stored procedures (I mean in any ORM in any > > technology I came across so far). > > > Thanks in advance for helping. > > > - Sofija > > On Friday, 16 March 2012 23:03:59 UTC, Sofija Blazevski wrote: > > > Hello, everyone! > > > I'm new to NHibernate, and I would like to use it together with > > FluentNHibernate. > > I've been trying to use them together for an updatable view scenario. > > > This is the problem: > > > None of the following Id generator classes > > <generator class="identity" /> > > <generator class="native" /> > > > allows inserting into updatable view. Updatable view (more precisely > > database server) takes care of assigning id. > > Each time I get "Null id" (or is it "Null identifier" ) thrown from > > ISession.SaveOrUpdate method. > > While, on the other hand, same scenario with inserting into table > > works perfectly. > > > On database everything is tested to work. > > NHibernate version is 3.2.0.4000 > > > What is correct way to setup NHibernate to allow inserting into a view > > without providing value for whatever field is set as Id? > > > I would like to use NHibernate for an application with intensive usage > > of views and stored procedures. > > Now, I know you probably don't like usage of updatable views, and I > > would not like to get into discussion on why do I use them, I simply > > need to use them - if I'm gonna use any ORM framework as there is no > > painless way to just use stored procedures (I mean in any ORM in any > > technology I came across so far). > > > Thanks in advance for helping. > > > - Sofija > > On Friday, 16 March 2012 23:03:59 UTC, Sofija Blazevski wrote: > > > Hello, everyone! > > > I'm new to NHibernate, and I would like to use it together with > > FluentNHibernate. > > I've been trying to use them together for an updatable view scenario. > > > This is the problem: > > > None of the following Id generator classes > > <generator class="identity" /> > > <generator class="native" /> > > > allows inserting into updatable view. Updatable view (more precisely > > database server) takes care of assigning id. > > Each time I get "Null id" (or is it "Null identifier" ) thrown from > > ISession.SaveOrUpdate method. > > While, on the other hand, same scenario with inserting into table > > works perfectly. > > > On database everything is tested to work. > > NHibernate version is 3.2.0.4000 > > > What is correct way to setup NHibernate to allow inserting into a view > > without providing value for whatever field is set as Id? > > > I would like to use NHibernate for an application with intensive usage > > of views and stored procedures. > > Now, I know you probably don't like usage of updatable views, and I > > would not like to get into discussion on why do I use them, I simply > > need to use them - if I'm gonna use any ORM framework as there is no > > painless way to just use stored procedures (I mean in any ORM in any > > technology I came across so far). > > > Thanks in advance for helping. > > > - Sofija > > On Friday, 16 March 2012 23:03:59 UTC, Sofija Blazevski wrote: > > > Hello, everyone! > > > I'm new to NHibernate, and I would like to use it together with > > FluentNHibernate. > > I've been trying to use them together for an updatable view scenario. > > > This is the problem: > > > None of the following Id generator classes > > <generator class="identity" /> > > <generator class="native" /> > > > allows inserting into updatable view. Updatable view (more precisely > > database server) takes care of assigning id. > > Each time I get "Null id" (or is it "Null identifier" ) thrown from > > ISession.SaveOrUpdate method. > > While, on the other hand, same scenario with inserting into table > > works perfectly. > > > On database everything is tested to work. > > NHibernate version is 3.2.0.4000 > > > What is correct way to setup NHibernate to allow inserting into a view > > without providing value for whatever field is set as Id? > > > I would like to use NHibernate for an application with intensive usage > > of views and stored procedures. > > Now, I know you probably don't like usage of updatable views, and I > > would not like to get into discussion on why do I use them, I simply > > need to use them - if I'm gonna use any ORM framework as there is no > > painless way to just use stored procedures (I mean in any ORM in any > > technology I came across so far). > > > Thanks in advance for helping. > > > - Sofija -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
