A few months ago I wrote a question asking for solutions to this error. There were some good answers but none of them provided me with a work around that was database independent. At least something that would work with both Oracle and SQL Server. I was implementing some calculated fields in NHibernate and I […]
Read More →Category: Open Source
NHibernate MappingException association references unmapped class
During the mapping process you may encounter this error. In my situation the case was that I had the wrong namespace identified within the class attribute within a bag element containing a one-to-many element, like the below. <bag name=”Customer”> <key column=”CUST_ID” /> <one-to-many class=”CompanyName.SysName.Nhibernate.Common.Customer” /> </bag> Instead of Common I had another directory […]
Read More →NHibernate MappingException an association from the table refers to an unmapped class
When you are creating your mapping files for which NHibernate uses to know the data types and relationships of the data model, you are likely to receive this error message: An association from the table TABLENAME refers to an unmapped class: CLASS The is usually generated from the class.hbm.xml file within a many-to-one mapping where […]
Read More →Foreign Key constraint conflict Parent Child using NHibernate
This was a tough one. I got everything working just fine with the mappings and my classes, I even wrote some test code to check if the Parent Child data was being inserted ok. What I failed to do was create the FOREIGN KEY relationship between the Parent table and the Child table. Once I […]
Read More →Foreign Key is always 0 (zero) when inserting Parent Child using NHibernate
This one was a toughy. I searched for some time looking for examples about HOW TO: INSERT PARENT / CHILD RELATIONSHIPS using NHIBERNATE. What I found were these really cool looking object oriented AddChild methods, many-to-one and one-to-many mapping relationships. The thing about those examples is that they do not take into account legacy database […]
Read More →NHibernate SchemaValidator TestConfigurationHelper
I was in a meeting where we had a discussion about keeping the modifications made to a database synchronized with the NHibernate mappings. Some said that there was a method called Validate() which just needed to be run and that all that was needed. I was right, it would turn out to be skeptical of […]
Read More →Nhibernate QuerySyntaxException is not mapped from
An important step which is often overlooked when beginning the process of mapping your database is to set the Build Action to Embedded Resource. (Buildvorgang – Eingebettete Resource). If you forget to do this you may receive a QuerySynataxException stating that the … is not mapped [from …]. It is also possible to store the […]
Read More →NHibernate could not execute query, ORA-00904 invalid identifier
This is a pretty easy one to solve. This happens because the column attribute in the mapping file does not exist on the database being accessed. <property name=”SpelledWrong” column=”SPELLDWRONG” type=”string” /> More than likely there is a spelling mistake or the column doesn’t exist on the table being mapped.
Read More →NHibernate Serialized startup
In all of my NHibernate implementations I serialize the startup. It saves a noticeable amount of time. We know that without it, NHibernate validates all the mapping files each time we start the program. If we only have 1 or 2 simple files it is not a problem, however, if you have a large implementation, […]
Read More →Nhibernate MappingException could not compile the mapping document
The following error is generally caused when there is a misspelling or case miss match between the class file and the mapping file. Review the contents of both and confirm spelling and case are the same so that the ‘Could not compile the mapping document: hbm.xml’ error can be avoided. The inner exception is something […]
Read More →