Note that there are some explanatory texts on larger screens.

plurals
  1. PONHibernate Mapping Exception
    primarykey
    data
    text
    <p>I am a newbie to NHibernate and am trying to use ORM with Sql Server 2012 my code is </p> <p>GazelleInfo.cs</p> <pre><code>namespace WCG.Data.EntityObjects { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.DataAnnotations; using System.Data.SqlTypes; ///&lt;summary&gt; ///Class to access Gazelle Info Table ///&lt;/summary&gt; public class GazelleInfo { public virtual int ID { get; set; } [Required(ErrorMessage = "Specialty Name is required.")] [Display(Name = "Specialty Name")] public virtual string SpecialtyName { get; set; } [Display(Name = "Specialty Name Active")] public virtual bool SpecialtyNameActive { get; set; } [Display(Name = "Preferred Language")] public virtual string PreferredLanguage { get; set; } [Display(Name = "Preferred Language Active")] public virtual bool PreferredLanguageActive { get; set; } [Display(Name = "Race")] public virtual string Race { get; set; } [Display(Name = "Race Active")] public virtual bool RaceActive { get; set; } [Display(Name = "Ethnicity")] public virtual string Ethnicity { get; set; } [Display(Name = "Ethnicity Active")] public virtual bool EthnicityActive { get; set; } [Display(Name = "Holiday Name")] public virtual string HolidayName { get; set; } [Display(Name = "Holiday Name Active")] public virtual bool HolidayNameActive { get; set; } } } </code></pre> <p>GazelleInfo.hbm.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Data" namespace="WCG.Data.EntityObjects"&gt; &lt;class name="GazelleInfo" table="GazelleInfo"&gt; &lt;id name="Id" column="Id" type="System.Int32"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="SpecialtyName" column="SpecialtyName" type="System.String" /&gt; &lt;property name="SpecialtyNameActive" column="SpecialtyNameActive" type="System.Boolean" insert="true" update="true"/&gt; &lt;property name="PreferredLanguage" column="PreferredLanguage" type="System.String" insert="true" update="true"/&gt; &lt;property name="PreferredLanguageActive" column="PreferredLanguageActive" type="System.Boolean" insert="true" update="true"/&gt; &lt;property name="Race" column="Race" type="System.String" insert="true" update="true"/&gt; &lt;property name="RaceActive" column="RaceActive" type="System.Boolean" insert="true" update="true"/&gt; &lt;property name="Ethnicity" column="Ethnicity" type="System.String" insert="true" update="true"/&gt; &lt;property name="EthnicityActive" column="EthnicityActive" type="System.Boolean" insert="true" update="true"/&gt; &lt;property name="HolidayName" column="HolidayName" type="System.String" insert="true" update="false"/&gt; &lt;property name="HolidayNameActive" column="HolidayNameActive" type="System.Boolean" insert="true" update="true"/&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>Hibernate.cfg.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" &gt; &lt;session-factory name="NHibernate.Test"&gt; &lt;property name="connection.driver_class"&gt;NHibernate.Driver.SqlClientDriver&lt;/property&gt; &lt;property name="connection.connection_string"&gt;Data Source=KNS009-PC;Initial Catalog=WomensCare;Integrated Security=True&lt;/property&gt; &lt;property name="dialect"&gt;NHibernate.Dialect.MsSql2012Dialect&lt;/property&gt; &lt;property name="proxyfactory.factory_class"&gt;NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu&lt;/property&gt; &lt;property name="query.substitutions"&gt;true 1, false 0, yes 'Y', no 'N'&lt;/property&gt; &lt;property name="current_session_context_class"&gt;NHibernate.Context.ThreadLocalSessionContext&lt;/property&gt; &lt;property name="hbm.ddl.auto"&gt;update&lt;/property&gt; &lt;!--&lt;property name="Show_Sql"&gt;true&lt;/property&gt;--&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>Configure.cs</p> <pre><code>namespace WCG.Data.DataAccessLayer.Hibernate { using NHibernate.Cfg; using System.Reflection; using System.IO; public class Configure { public Configure() { } public static Configuration GetConfiguration(string configPath) { var directoryName = configPath; Configuration cfg = new Configuration().Configure(directoryName + @"\Hibernate.cfg.xml") .AddFile(directoryName + @"\User.hbm.xml") .AddFile(directoryName + @"\Role.hbm.xml") .AddFile(directoryName + @"\RolePrivilege.hbm.xml") .AddFile(directoryName + @"\Privilege.hbm.xml") .AddFile(directoryName + @"\Patient.hbm.xml") .AddFile(directoryName + @"\Report.hbm.xml") .AddFile(directoryName + @"\CommentMaster.hbm.xml") .AddFile(directoryName + @"\AuditEntry.hbm.xml") .AddFile(directoryName + @"\ReportHistory.hbm.xml") .AddFile(directoryName + @"\ReportStatus.hbm.xml") .AddFile(directoryName + @"\Emailtemplates.hbn.xml") .AddFile(directoryName + @"\DemographicInfo.hbm.xml") .AddFile(directoryName + @"\InsuranceInfo.hbm.xml") .AddFile(directoryName + @"\MaritalStatus.hbm.xml") .AddFile(directoryName + @"\MedicalHistory.hbm.xml") .AddFile(directoryName + @"\PatientRelationship.hbm.xml") .AddFile(directoryName + @"\lablabel.hbm.xml") .AddFile(directoryName + @"\CompanyInfo.hbm.xml") .AddFile(directoryName + @"\MensurationHistory.hbm.xml") .AddFile(directoryName + @"\PastPregnancies.hbm.xml") .AddFile(directoryName + @"\PastMedicalHistoryInfo.hbm.xml") .AddFile(directoryName + @"\PastMedicalHistory.hbm.xml") .AddFile(directoryName + @"\HospitalizationDetails.hbm.xml") .AddFile(directoryName + @"\DrugDetails.hbm.xml") .AddFile(directoryName + @"\PastMedicalHistoryComments.hbm.xml") .AddFile(directoryName + @"\GeneticScreening.hbm.xml") .AddFile(directoryName + @"\GeneticScreeningInfo.hbm.xml") .AddFile(directoryName + @"\GeneticScreeningComments.hbm.xml") .AddFile(directoryName + @"\InfectionHistory.hbm.xml") .AddFile(directoryName + @"\InfectionHistoryComments.hbm.xml") .AddFile(directoryName + @"\InfectionHistoryInfo.hbm.xml") .AddFile(directoryName + @"\MedicationAgents.hbm.xml") .AddFile(directoryName + @"\CompanyPlanInfo.hbm.xml") .AddFile(directoryName + @"\SyncKareo.hbm.xml") .AddFile(directoryName + @"\NonHospitalizationDetails.hbm.xml") .AddFile(directoryName + @"\PayerScenario.hbm.xml") .AddFile(directoryName + @"\AdminDemographicInfo.hbm.xml") .AddFile(directoryName + @"\AdminInsuranceInfo.hbm.xml") .AddFile(directoryName + @"\SoapNotes.hbm.xml") .AddFile(directoryName + @"\CurrentMedicationInfo.hbm.xml") .AddFile(directoryName + @"\CurrentMedication.hbm.xml") .AddFile(directoryName + @"\Allergies.hbm.xml") .AddFile(directoryName + @"\AllergiesInfo.hbm.xml") .AddFile(directoryName + @"\Pharmacy.hbm.xml") .AddFile(directoryName + @"\PatientPharmacy.hbm.xml") .AddFile(directoryName + @"\DemographicInfoHistory.hbm.xml") .AddFile(directoryName + @"\PatientsHistory.hbm.xml") .AddFile(directoryName + @"\UserHistory.hbm.xml") .AddFile(directoryName + @"\InsuranceInfoHistory.hbm.xml") .AddFile(directoryName + @"\MainPatientHistory.hbm.xml") .AddFile(directoryName + @"\HistoryMensurationHistory.hbm.xml") .AddFile(directoryName + @"\HistoryInfectionHistoryComments.hbm.xml") .AddFile(directoryName + @"\HistoryGeneticScreeningComments.hbm.xml") .AddFile(directoryName + @"\HistoryPastMedicalHistoryComments.hbm.xml") .AddFile(directoryName + @"\HistoryInfectionHistory.hbm.xml") .AddFile(directoryName + @"\HistoryDrugDetails.hbm.xml") .AddFile(directoryName + @"\HistoryHospitalizationDetails.hbm.xml") .AddFile(directoryName + @"\HistoryNonHospitalizationDetails.hbm.xml") .AddFile(directoryName + @"\HistoryAllergies.hbm.xml") .AddFile(directoryName + @"\HistoryCurrentMedication.hbm.xml") .AddFile(directoryName + @"\HistoryPastPregnancies.hbm.xml") .AddFile(directoryName + @"\HistoryGeneticScreening.hbm.xml") .AddFile(directoryName + @"\HistoryMedicationAgents.hbm.xml") .AddFile(directoryName + @"\MainMedicalHistory.hbm.xml") .AddFile(directoryName + @"\HistoryPastMedicalHistory.hbm.xml") .AddFile(directoryName + @"\PaymentMethod.hbm.xml") .AddFile(directoryName + @"\FrontDeskPaymentHistory.hbm.xml") .AddFile(directoryName + @"\FinancialInfo.hbm.xml") .AddFile(directoryName + @"\ObPatients.hbm.xml") .AddFile(directoryName + @"\Locations.hbm.xml") .AddFile(directoryName + @"\LocationDetails.hbm.xml") .AddFile(directoryName + @"\LocationSpecialDetails.hbm.xml") .AddFile(directoryName + @"\Holidays.hbm.xml") .AddFile(directoryName + @"\VisitType.hbm.xml") .AddFile(directoryName + @"\CalendarDisplayRange.hbm.xml") .AddFile(directoryName + @"\CalendarStatus.hbm.xml") .AddFile(directoryName + @"\Appointments.hbm.xml") .AddFile(directoryName + @"\SchedulingProfile.hbm.xml") .AddFile(directoryName + @"\SchedulingProfileDetails.hbm.xml") .AddFile(directoryName + @"\ReplyEmail.hbm.xml") .AddFile(directoryName + @"\OnlineApptWindow.hbm.xml") .AddFile(directoryName + @"\MultiAppointmentsColor.hbm.xml") .AddFile(directoryName + @"\FaxHistory.hbm.xml") .AddFile(directoryName + @"\GazelleInfo.hbm.xml"); return cfg; } } } </code></pre> <p>i am getting some other exception </p> <p>Have a look at the error info </p> <pre><code> [XmlSchemaException: The Enumeration constraint failed.] [XmlSchemaValidationException: The 'name' attribute is invalid - The value 'hbm.ddl.auto' is invalid according to its datatype 'String' - The Enumeration constraint failed.] [HibernateConfigException: An exception occurred parsing configuration :The 'name' attribute is invalid - The value 'hbm.ddl.auto' is invalid according to its datatype 'String' - The Enumeration constraint failed.] NHibernate.Cfg.XmlSchemas.ConfigSettingsValidationEventHandler(Object sender, ValidationEventArgs e) +137 System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(XmlSchemaValidationException e, XmlSeverityType severity) +91 System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(String code, String[] args, Exception innerException) +87 System.Xml.Schema.XmlSchemaValidator.CheckAttributeValue(Object value, SchemaAttDef attdef) +318 System.Xml.Schema.XmlSchemaValidator.ValidateAttribute(String lName, String ns, XmlValueGetter attributeValueGetter, String attributeStringValue, XmlSchemaInfo schemaInfo) +1166 System.Xml.Schema.XmlSchemaValidator.ValidateAttribute(String localName, String namespaceUri, XmlValueGetter attributeValue, XmlSchemaInfo schemaInfo) +28 System.Xml.XsdValidatingReader.ValidateAttributes() +144 System.Xml.XsdValidatingReader.ProcessElementEvent() +620 System.Xml.XsdValidatingReader.ProcessReaderEvent() +56 System.Xml.XsdValidatingReader.Read() +48 System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space) +523 System.Xml.XPath.XPathDocument..ctor(XmlReader reader, XmlSpace space) +19 System.Xml.XPath.XPathDocument..ctor(XmlReader reader) +6 NHibernate.Cfg.ConfigurationSchema.HibernateConfiguration..ctor(XmlReader hbConfigurationReader, Boolean fromAppSetting) +186 NHibernate.Cfg.ConfigurationSchema.HibernateConfiguration..ctor(XmlReader hbConfigurationReader) +39 NHibernate.Cfg.Configuration.Configure(XmlReader textReader) +304 NHibernate.Cfg.Configuration.Configure(String fileName, Boolean ignoreSessionFactoryConfig) +142 NHibernate.Cfg.Configuration.Configure(String fileName) +44 WCG.Data.DataAccessLayer.Hibernate.Configure.GetConfiguration(String configPath) in c:\Users\Admin\Desktop\womenscare\womencare\Data\DataAccessLayer\Configure.cs:18 Web.Global.Application_Start() in </code></pre> <p>c:\Users\Admin\Desktop\womenscare\womencare\Web\Global.asax.cs:40</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload