-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: composite-element in map problem
PostPosted: Sun Jun 10, 2007 5:53 pm 
Newbie

Joined: Sun Jun 10, 2007 5:32 pm
Posts: 8
Location: Gothenburg
Hi!

I receive a NHibernate.MappingException with message 'collection was not an association: Ikaros.WeekReport.Server.BusinessEntities.Report.reportReadBy' when using a composite-element within a map, but not when I use a simple element.

I have this:

Code:
public class Report {
...

        private IDictionary<ReportLineHeader, String> lines = new Dictionary<ReportLineHeader, String>();

        public virtual IDictionary<ReportLineHeader, String> Lines
        {
            get { return lines; }
            set { lines = value; }
        }

        private IDictionary<User, ReportReadByUser> reportReadBy = new Dictionary<User, ReportReadByUser>();

        public virtual IDictionary<User, ReportReadByUser> ReportReadBy
        {
            get { return reportReadBy; }
            set { reportReadBy = value; }
        }
}


And mappings for the Report class:

Code:
<map name="lines" access="field" cascade="all-delete-orphan" inverse="false" lazy="true" table="ReportLine">
      <cache usage="read-write" />
      <key column="ReportId" />
      <index-many-to-many class="ReportLineHeader" column="ReportLineHeaderId" />
      <element column="Body" type="String" not-null="true" length="4000" />
</map>

<map name="reportReadBy" access="field" cascade="all-delete-orphan" lazy="true" table="ReportReadByUser">
      <cache usage="read-write"/>
      <key column="ReportId" />
      <index-many-to-many class="User" column="UserId" />
      <composite-element class="ReportReadByUser">
        <property name="Date" not-null="true" />
        <property name="AsManager" not-null="true" />
      </composite-element>
</map>


For some reason the first mapping works, but the second doesn't work for me. The first mapping was using a composite-element at first as well, changing it to use a element fixed the problem. Unfortunately I can't do the same with the second mapping since it has two properties.

I'm using NHibernate 1.2.0.GA.

Any help would be very much appreciated!

BR // Peter


Top
 Profile  
 
 Post subject: Problem solved
PostPosted: Mon Jul 23, 2007 1:24 pm 
Newbie

Joined: Sun Jun 10, 2007 5:32 pm
Posts: 8
Location: Gothenburg
cascade="all-delete-orphan" was not allowed for this mapping.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.