List of enums mapped with type="int32" can't be loaded anymore
Description
Environment
None
Activity
Show:

Fabio Maulo May 14, 2009 at 6:15 PM
As I said wrong mapping
<bag name="Things">
<key column="bid"/>
<element type="NHibernate.Test.NHSpecificTest.ElementsEnums.Something, NHibernate.Test" column="enumvalue"/>
</bag>
btw I'll improve the mapping to allow some short declaration of type including type deduction from generic collection argument-type.

Fabio Maulo May 13, 2009 at 12:11 PM
but enums can't be mapped to Int32 because NH will interpret it as a changed value.
Can you send little test ?
Not an Issue
Details
Details
Assignee
Unassigned
UnassignedReporter

Components
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created May 11, 2009 at 9:49 AM
Updated May 14, 2009 at 6:15 PM
Resolved May 14, 2009 at 6:15 PM
Who's Looking?
Mapping:
<bag name="Property">
<key .../>
<element
type="Int32"
column="Value" />
</bag>
Enum declaration:
public enum MyEnum : int
{
// ...
}
When loading the value from the database, it produces a System.ArgumentException, In Collection.PersistentBag.cs line 74, because it tries to add a int value to a generic collection of MyEnum. In version 2.0, this worked fine.
When specifying the correct EnumType in the mapping file, it works fine. So this is probably not an issue, but should be documented.