Using enum strings with NHibernate persistence - level 400
Posted by: Jeffrey Palermo,
on 14 Mar 2006 |
View original | Bookmarked: 0 time(s)
One of the things that is not very obvious when using NHibernate is how to using Enumerations. If you merely map an enum with the hbm.xml, NHibernate will persist that class member as an int, which is the underlying type of an Enum value type. Even if you have your database table configured with a string field, you'll get an integer in your string field.To have NHibernate use the string representation of the enum for storing in the database, you need to use a special type class. ...