NHibernate Beta 1.2.0 Beta2
Oracle 10g
We are having issues retrieving enum values when we mark the enum as nullable in our object. It seems that NHibernate cannot handle nullable enums, or that my mapping is incorrect. Can someone verify either way.
In the example NHibernate throws a mapping exception when we attempt to load an instance of the Person object. If we remove the "?" from the Gender on Person all is fine. What should we do to use nullable enums?
simple example
public enum GenderType : int
{
Male = 1,
Female = 2
}
public class Person
{
string _name;
GenderType? _gender;
int _id;
public virtual int Id
{
get { return _id; }
protected set { _id = value; }
}
public virtual string Name
{
get { return _name; }
set { _name = value; }
}
public virtual GenderType? Gender
{
get { return _gender; }
set { _gender = value; }
}
}
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Person" table="Person">
<id column="PersonID" type="Int32" name="Id">
<generator class="NHibernate.Id.SequenceGenerator">
<param name="sequence">Person_S</param>
</generator>
</id>
<property column="NAME" type="String" name="Name"/>
<property column="GENDER" type="Int32" name="Gender"/>
</class>
</hibernate-mapping>
|