This is an ASP.NET application, for a strange reason i cannot seem to do a search on certains criterias, this is called in a thread, the first object goes thru with success, the other ones steam out this error on my log file. What could cause an object not properly executing a get on a object with a specific criteria, also a strange thing is that i am not exactly modifying any objects here. Can somebody help me here, i am fixing someone else's debacle, and i am a first time nhibernate user. I followed the exampled in the compiled help.
Any input is appreciated from the pro's
Hibernate version: 1.2.1
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Data.BLL.PatientPrescription,Data" table="PatientPrescription" >
<id name="IdPatientPrescription" column="IdPatientPrescription" type="Int32" >
<generator class="identity"/>
</id>
<property column="IdImportation" type="Int64" name="IdImportation" />
<property column="RefPatient" type="Int32" name="RefPatient" />
<property column="A0303CodeTransac" type="Int32" name="A0303CodeTransac" not-null="true" />
<property column="A0403ProviderSoftwareID" type="String" name="A0403ProviderSoftwareID" not-null="true" />
<property column="A0503ProviderSoftwareVersion" type="String" name="A0503ProviderSoftwareVersion" not-null="true" />
<property column="B2103PharmacyIDCode" type="String" name="B2103PharmacyIDCode" not-null="true" />
<property column="B2203ProviderTransactionDate" type="DateTime" name="B2203ProviderTransactionDate" not-null="true" />
<property column="C3603Relationship" type="String" name="C3603Relationship" not-null="true" />
<property column="D5203NewRefillCode" type="String" name="D5203NewRefillCode" not-null="true" />
<property column="D5303OriginalPrescriptionNumber" type="String" name="D5303OriginalPrescriptionNumber" not-null="true" />
<property column="D5403RefillRepeatAuthorizations" type="String" name="D5403RefillRepeatAuthorizations" not-null="true" />
<property column="D5603DIN_GP_PIN" type="Int32" name="D5603DIN_GP_PIN" not-null="true" />
<property column="D5803Quantity" type="String" name="D5803Quantity" not-null="true" />
<property column="D5902DaysSupply" type="String" name="D5902DaysSupply" not-null="true" />
<property column="D6003PrescriberIDReference" type="String" name="D6003PrescriberIDReference" not-null="true" />
<property column="D6103PrescriberID" type="String" name="D6103PrescriberID" not-null="true" />
<property column="D6603DrugCostProductValue" type="String" name="D6603DrugCostProductValue" not-null="true" />
<property column="D6703CostUpcharge" type="String" name="D6703CostUpcharge" not-null="true" />
<property column="D6803ProfessionalFee" type="String" name="D6803ProfessionalFee" not-null="true" />
<property column="posologie" type="String" name="posologie" not-null="true" />
<property column="Assurance1Code" type="String" name="Assurance1Code" not-null="true" />
<property column="Assurance1Montant" type="String" name="Assurance1Montant" not-null="true" />
<property column="Assurance2Code" type="String" name="Assurance2Code" not-null="true" />
<property column="Assurance2Montant" type="String" name="Assurance2Montant" not-null="true" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
NHibernate.ICriteria crit = mngrPrescription.GetSession().CreateCriteria(typeof(Data.BLL.PatientPrescription));
crit.Add(new NHibernate.Expression.EqExpression("A0303CodeTransac", p.A0303CodeTransac));
crit.Add(new NHibernate.Expression.EqExpression("B2103PharmacyIDCode", p.B2103PharmacyIDCode));
crit.Add(new NHibernate.Expression.EqExpression("B2203ProviderTransactionDate", p.B2203ProviderTransactionDate));
crit.Add(new NHibernate.Expression.EqExpression("D5303OriginalPrescriptionNumber", p.D5303OriginalPrescriptionNumber));
crit.Add(new NHibernate.Expression.EqExpression("D5403RefillRepeatAuthorizations", p.D5403RefillRepeatAuthorizations));
IList patients = crit.List();
Full stack trace of any exception that occurs:Code:
Message "identifier of an instance of Data.BLL.PatientPrescription altered from 1 (System.Int32) to 0 (System.Int32)" string
StackTrace " at NHibernate.Impl.SessionImpl.CheckId(Object obj, IClassPersister persister, Object id)\r\n at NHibernate.Impl.SessionImpl.FlushEntity(Object obj, EntityEntry entry)\r\n at NHibernate.Impl.SessionImpl.FlushEntities()\r\n at NHibernate.Impl.SessionImpl.FlushEverything()\r\n at NHibernate.Impl.SessionImpl.AutoFlushIfRequired(ISet querySpaces)\r\n at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)\r\n at NHibernate.Impl.CriteriaImpl.List()\r\n at Data.Import.ImportPrescription.Import() in xxx.cs:line 131" string
Name and version of the database you are using:
SQL Express 2005
The generated SQL (show_sql=true):
What i can show that where ?
Debug level Hibernate log excerpt:
What ? where can i set this thing to log all operations ?