﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>NAC,
  
You have to traverse the association from the other side
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment12</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment12</guid><pubDate>Sun, 26 Apr 2009 07:40:56 GMT</pubDate></item><item><title>NAC commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Is there any way you can write HQL queries that cross this to-any relationship --- even if at query time you know the type of the entity on the other end? 
  
  
I.e. the casting equivalent of select ... from foo where (KnownType)foo.anyRelation.number=12 ?
  
  
Or no need to do that?
  
  
    N
  
  
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment11</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment11</guid><pubDate>Sun, 26 Apr 2009 02:38:50 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Jeroen,
  
The problem is that it is using the same model from the previous post, so Payment property is empty, so it is putting null there.
  
  
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment10</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment10</guid><pubDate>Thu, 23 Apr 2009 17:23:45 GMT</pubDate></item><item><title>Jeroen commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>It already makes sense. Had to check your previous post to understand the table structures.
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment9</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment9</guid><pubDate>Thu, 23 Apr 2009 12:08:57 GMT</pubDate></item><item><title>Jeroen commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Can you explain the first SQL statement (i.e. insert into orders(PaymentType, PaymentId) values (NULL, NULL))?
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment8</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment8</guid><pubDate>Thu, 23 Apr 2009 11:52:09 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Yazid,
  
If this is not a question about this post, please use the nhusers mailing list for that
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment7</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment7</guid><pubDate>Thu, 23 Apr 2009 10:24:21 GMT</pubDate></item><item><title>Yazid commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Hello,
  
  
I would like to take to this opportunity to ask a question about one-to-many. I have two classes:
  
  
GeneralInformation and famousPlacesInLondon
  
  
public class GeneralInformation
  
{
  
  
        private int id;
  
  
        public virtual int Id
  
        {
  
            get { return id; }
  
            set { id = value; }
  
        }
  
  
        private IList
&lt;famousplacesinlondon famousPlacesOutLondon;
  
  
        public virtual IList
&lt;famousplacesinlondon FamousPlacesOutLondon
  
        {
  
            get { return famousPlacesOutLondon; }
  
            set { famousPlacesOutLondon = value; }
  
        }
  
}
  
  
public class FamousPlacesInLondon
  
{
  
        private int id;
  
  
        public virtual int Id
  
        {
  
            get { return id; }
  
            set { id = value; }
  
        }
  
        private string link;
  
  
        public virtual string Link
  
        {
  
            get { return link; }
  
            set { link = value; }
  
        }
  
        private string title;
  
  
        public virtual string Title
  
        {
  
            get { return title; }
  
            set { title = value; }
  
        }
  
  
    }
  
}
  
  
My mappings are as follows:
  
  
  
&lt;hibernate-mapping  
&lt;class  
&lt;id  
&lt;generator  
&gt;  
&lt;bag  
&lt;key  
&lt;one-to-many  
&gt;  
  
  
  
  
&lt;hibernate-mapping  
&lt;class  
&lt;id  
&lt;generator  
&gt;  
&lt;property  
&lt;property  
&gt;  
  
  
If I fill the GeneralInformation class with data and do a save using NHibernate, everything gets inserted into the appropriate tables, except the ForeignKey GeneralInformationId. What is wrong?
  
  
TIA
  
Yaz
  
  
  
  
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment6</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment6</guid><pubDate>Thu, 23 Apr 2009 09:52:08 GMT</pubDate></item><item><title>John commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>I had no idea this mapping even existed!  I always read your posts because I'm constantly either learning something new or they force me to think through issues that I've never considered or from a viewpoint that I hadn't previously taken.  Thanks for the education!!!
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment5</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment5</guid><pubDate>Wed, 22 Apr 2009 15:08:35 GMT</pubDate></item><item><title>Kenny Eliasson commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Really appreciate the work with these series, gonna print them out and make a little book of it for my colleagues. Thanks!
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment4</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment4</guid><pubDate>Wed, 22 Apr 2009 11:06:40 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Oh, no, sorry.
  
Order have those columns because (not seen in this post), Order also have an any association to payment.
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment3</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment3</guid><pubDate>Wed, 22 Apr 2009 05:26:55 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>Nathan,
  
How else could it have a reference for payment?
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment2</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment2</guid><pubDate>Wed, 22 Apr 2009 05:25:58 GMT</pubDate></item><item><title>Nathan commented on NHibernate Mapping - &lt;many-to-any/&gt;</title><description>I must be missing something: why does the Order table have PaymentType and PaymentId columns?
</description><link>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment1</link><guid>http://ayende.com/3967/nhibernate-mapping-many-to-any#comment1</guid><pubDate>Wed, 22 Apr 2009 04:53:11 GMT</pubDate></item></channel></rss>