wrong group. You need to post this over in the Fluent NH user group.
On Thu, Jun 3, 2010 at 8:24 AM, Dana Efros <[email protected]> wrote:
> I can't make it to work for the HasMany part:
> In the mapping for A class:
>
> Map(x =>
> x.UniqueIdentifier).Column("avUniqueIdentifier").Unique().Not.Nullable();
> HasMany(x => x.Children)
> .KeyColumn("avUniqueIdentifier")
> .Table("Childrens");
>
> In the mapping for B class:
>
> References(x => x.Parent).Not.Nullable()
> .PropertyRef(x=>x.UniqueIdentifier)
> .Column("avUniqueIdentifier");
>
> But I get the error:
> 15:22:55,795 ERROR [ 7] SchemaExport [(null)]- Column 'As.aId' is
> not the same data type as referencing column 'Bs.avUniqueIdentifier'
> in foreign key 'FK6B5005B1E3E18454'.
> Could not create constraint.
>
> If I remove the column name setter from
> References(x => x.Parent).Not.Nullable()
> .PropertyRef(x=>x.UniqueIdentifier);
>
> nhibernate create 2 columns in the B table
>
>
> On Jun 3, 11:57 am, Oskar Berggren <[email protected]> wrote:
> > property-ref
> >
> > http://nhforge.org/doc/nh/en/index.html#mapping-declaration-manytoone
> >
> > /Oskar
> >
> > 2010/6/3 Dana Efros <[email protected]>:
> >
> > > Hi, All
> >
> > > I have to entities:
> > > public class A : EntityWithTypedId<long>
> > > {
> > > Guid UniqueIdentifier;
> > > IList<B> Children;
> > > }
> >
> > > public class B: EntityWithTypedId<long>
> > > {
> > > A Parent;
> > > .....
> > > }
> >
> > > I want to make the reference using the Guid column not the primary key
> > > Id (so I will have in the B table UniqueIdentifier not A_id). It this
> > > possible?
> > > 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]<nhusers%[email protected]>
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/nhusers?hl=en.
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
thanks
cliff
--
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.