Tags: NHibernate

Nhibernate QuerySyntaxException is not mapped from

NHibernate Benjamin Perkins

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

NHibernate Benjamin Perkins

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

NHibernate Benjamin Perkins

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 3.2, What’s New?

NHibernate Benjamin Perkins

The newest release is as BETA 1 when writing this blog an it contains some new and nice features. One of my favorite is that as a programmer we no longer need to configure a proxy. It was always a little confusing knowing which one to choose, I.e. looking in the Required_For_LazyLoading directory and deciding […]

Read More →

Using LIKE with LINQ to NHibernate in C#

NHibernate Benjamin Perkins

The equivalent to LIKE via the LINQ to NHibernate provider is Contains. An example of a LINQ to NHibernate that will return a result set matching a search like parameter is below. IQueryable<Classname> linqLIKE =         (from m in session.Query<Classname>()          where m.Code.Contains(“%dex%”)          orderby m.CreateDate          select m); IList<Classname> ListLIKE = linqLIKE.ToList(); The above […]

Read More →

NHibernate mapping experience with an ambiguous reference

NHibernate Benjamin Perkins

Sometime things don’t always go as planned. I was making some nice progress with the process of mapping a database and all of a sudden I get the following compile time error message. Ambiguous type reference. A type named “Attribute” occurs in at least two namespaces. “Attribute” ist ein mehrdeutiger Verweis und kann “System.Attribute” oder […]

Read More →