Hi all,

I have problems to map the following situation:

private IDictionary<Region, DailyPeriod> specialCollectionAreas = new
Dictionary<Region, DailyPeriod>();

Where as Region is a normal mapped class and DailyPeriod is an
unmapped class, which uses
DailyPeriodType (ICompositeUserType). In the end I hope to get
something like this:

| id | regionId | hourBegin | minuteBegin | hourEnd | minuteEnd |
-------------------------------------------------------------------------------
| 1 | 15          | 10             | 0                 | 10          |
30             |

or in c#
com.SpecialCollectionAreas.Add( new KeyValuePair<Region, DailyPeriod>
(r2, new DailyPeriod(10, 00, 10, 30)));

This is one of many tries to map it:

        [NHibernate.Mapping.Attributes.IdBag(0, Table =
"community_specialcollectionareas", Cascade = "all", Lazy = true)]
        [NHibernate.Mapping.Attributes.CollectionId(1, Column = "id",
TypeType = typeof(Int32))]
        [NHibernate.Mapping.Attributes.Generator(2, Class =
"sequence")]
        [NHibernate.Mapping.Attributes.Key(3, Column = "region_id")]
        [NHibernate.Mapping.Attributes.Element(4, TypeType = typeof
(DailyPeriodType), Column = "property")]
        //[NHibernate.Mapping.Attributes.Column(5, Name =
"hourBegin")]
        //[NHibernate.Mapping.Attributes.Column(6, Name =
"minuteBegin")]
        //[NHibernate.Mapping.Attributes.Column(7, Name = "hourEnd")]
        //[NHibernate.Mapping.Attributes.Column(8, Name =
"minuteEnd")]

But in the end i got this exception:
11:03:36 NHibernate.Cfg.Configuration: Could not compile the mapping
document: (unknown)
NHibernate.MappingException: Could not compile the mapping document:
(unknown) ---> NHibernate.MappingException: Error m
apping generic collection
AloaObjects.Domain.Management.Community.SpecialCollectionAreas:
expected 1 generic parameters,
 but the property type has 2
   at NHibernate.Mapping.Collection.CheckGenericArgumentsLength(Int32
expectedLength)
   at NHibernate.Mapping.IdentifierBag.get_DefaultCollectionType()
   at NHibernate.Mapping.Collection.get_CollectionType()
   at NHibernate.Mapping.Collection.get_Type()
   at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindProperty(XmlNode
node, Property property)
   at NHibernate.Cfg.XmlHbmBinding.ClassBinder.CreateProperty(IValue
value, String propertyName, Type parentClass, XmlNo
de subnode)
   at NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML
(XmlNode node, PersistentClass model)
   at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(XmlNode node,
HbmClass classSchema)
   at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses
(XmlNode parentNode)
   at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode
node)
   at NHibernate.Cfg.Configuration.AddValidatedDocument
(NamedXmlDocument doc)
   --- End of inner exception stack trace ---

Unhandled Exception: NHibernate.MappingException: Could not compile
the mapping document: (unknown) ---> NHibernate.Mapp
ingException: Error mapping generic collection
AloaObjects.Domain.Management.Community.SpecialCollectionAreas:
expected
1 generic parameters, but the property type has 2
   at NHibernate.Mapping.Collection.CheckGenericArgumentsLength(Int32
expectedLength)
   at NHibernate.Mapping.IdentifierBag.get_DefaultCollectionType()
   at NHibernate.Mapping.Collection.get_CollectionType()
   at NHibernate.Mapping.Collection.get_Type()
   at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindProperty(XmlNode
node, Property property)
   at NHibernate.Cfg.XmlHbmBinding.ClassBinder.CreateProperty(IValue
value, String propertyName, Type parentClass, XmlNo
de subnode)
   at NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML
(XmlNode node, PersistentClass model)
   at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(XmlNode node,
HbmClass classSchema)
   at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses
(XmlNode parentNode)
   at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode
node)
   at NHibernate.Cfg.Configuration.AddValidatedDocument
(NamedXmlDocument doc)
   --- End of inner exception stack trace ---
   at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
   at NHibernate.Cfg.Configuration.AddValidatedDocument
(NamedXmlDocument doc)
   at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
   at NHibernate.Cfg.Configuration.AddInputStream(Stream
xmlInputStream, String name)
   at NHibernate.Cfg.Configuration.AddInputStream(Stream
xmlInputStream)
   at AloaLibrary.Database.SessionProvider.SetupNHibernate() in E:\aloa
\src\Aloa\AloaLibrary\Database\SessionProvider.cs
:line 88
   at AloaLibrary.Database.Generator.CreateTablesAtDatabase
(ConnectionSettings settings) in E:\aloa\src\Aloa\AloaLibrary
\Database\Generator.cs:line 19
   at AloaBridge.Program.Run() in E:\aloa\src\Aloa\AloaBridge
\Program.cs:line 103

Hope somebody can give me a hint,
thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to