Id (x = x.id).
1. Nhibernate.propertyvalueexception:not-null property references a nullor transient value abc.de. FG
Insert value does not set NULL
2. Row was updated or deleted by another transaction (Orunsaved-value mapping was incorrect)
Try{session.persist (instance);} catch (Persistentobjectexception e) {try{session.merge (instance);} catch (Staleobjectstateexception ex) {Session.save (instance);}}
3. NHibernate:
SqlDateTime overflow. Must be between 1/1/175312:00:00 AM and 12/31/9999 11:59:59 PM.
Reason: System.DateTime is avalue type in. Net, which means the it can never be null. But what Happenswhen has a nullable date time in the database, and do you load it into Adatetime type? When NHibernate loads a null value from the database, Itcannot put a null in the Updateddate property, the CLR doesn ' t all ow it. Whathappens is, the Updateddate property was set to the default DateTime value,in this case:01/01/0001.
Solution:
Public virtual DateTime Utccreatedt {get; set;}
->public virtual DateTime? Utccreatedt {get; set;}
->public virtual nullable<datetime> Utccreatedt {get; set;}
4. FluentNHibernate.Cfg.FluentConfigurationException:An invalid or incomplete configuration is used while creating aSes Sionfactory. Check potentialreasons Collection, and innerexception for Moredetail.
---> FluentNHibernate.Visitors.ValidationException:Theentity ' accrualmethodmodel ' doesn ' t has anId Mapped. Use the Id of method to map your identity property. Forexample:
Reason:every mapping requires an Id of some kind. The ID ismapped using the ID method, which takes a lambda expression thataccesses the property on your entity that would be Used for the Id. Depending onthe return type of the property accessed in the lambda, Fluent NHibernate willmake some assu Mptions about the kind of identifier you ' re using. For example,if your The Id property is a int, an identity column is assumed. Similarly,if you use a GUID and then a GUID comb isassumed.
Id(x => x.Id);
Note that the property, supply to Id can haveany name; It does not has the called "Id," as shown here.
[Troubleshooting] Nhibernate usage