Yes, the question was if there's another option, as in FNH is not
possible to specify the column of a many-to-one relationship (uses
always PK).

Actually the solution you linked works but at the end we decided not
to go all the way and just localize some particular cases using a
translation table for each entity that needs a localizable property
that has to be sorted via SQL.

On 11 Març, 09:24, Dinoboy <[email protected]> wrote:
> I actually don't quite understand the problem you are having.
>
> You said:
> "The question is: is specifying the "column" property of a <many-to-
> one> relationship the way to tell NH that I don't want to use the
> default id to create a relationship?"
>
> Answers is yes.
>
> For example, mapping localizable names properties in NH looks like
> this:
> <many-to-one name="FirstName" column="firstname_id"
> class="Translation" fetch="join" />
> <many-to-one name="LastName" column="lastname_id" class="Translation"
> fetch="join" />
> FNH equivalent should be:
> References(person => person.FirstName,
> "firstname_id").FetchType.Join();
> References(person => person.LastName, "lastname_id").FetchType.Join();
>
> Is this what you meant?
>
> On Mar 10, 4:45 pm, Marc Climent <[email protected]> wrote:
>
> > Thanks for your interest, Fabio. You're right.
>
> > I couldn't reproduce Dinoboy's solution in FNH, but if it's the only
> > solution I will try harder.
>
> > The question is: is specifying the "column" property of a <many-to-
> > one> relationship the way to tell NH that I don't want to use the
> > default id to create a relationship?
>
> > Maybe I'm making it too complicated.
>
> > On 10 Març, 14:46, Fabio Maulo <[email protected]> wrote:
>
> > > if so what mean this:
> > > "Nice solution, but using Fluent NHibernate I can't set the columns of the
> > > entity table that I want to map to the localizations table."
>
> > > 2010/3/10 Marc Climent <[email protected]>
>
> > > > Neither. But doing it with NH is the first step to do it with FNH.
>
> > > > On 10 Març, 14:35, Fabio Maulo <[email protected]> wrote:
> > > > > I don't understand where your problem is...
> > > > > You can't do it with NHibernate or you can't do it with FNH ?
>
> > > > > 2010/3/10 Marc Climent <[email protected]>
>
> > > > > > Nice solution, but using Fluent NHibernate I can't set the columns 
> > > > > > of
> > > > > > the entity table that I want to map to the localizations table. I
> > > > > > asked there if anyone knows how to do that.
>
> > > > > > Anyway, I've been looking at the solution and I'm quite frustrated,
> > > > > > feeling like a noob...
>
> > > > > > I've been able to do the trick if there's only one Localizable
> > > > > > property per entity but I don't know how to tell NHibernate that I
> > > > > > want to create several relationships from one entity to the other
> > > > > > using different columns.
>
> > > > > > On 4 Març, 16:00, Dinoboy <[email protected]> wrote:
> > > > > > > I'm using this approach described herehttp://
> > > > > >www.siimviikman.com/2010/02/24/mapping-translations-in-nhibern...
> > > > > > > . I don't use components nor elements, all related objects are
> > > > > > > entities.
> > > > > > > When I need to show data in the listview, I create specific query 
> > > > > > > in
> > > > > > > HQL which returns projections which are optimized for the needs of
> > > > the
> > > > > > > view.
>
> > > > > > > On Mar 4, 4:02 pm, Marc Climent <[email protected]> wrote:
>
> > > > > > > > The thing is not the ordering, but how to associate the field 
> > > > > > > > with
> > > > > > > > it's translation using Nhibernate.
>
> > > > > > > > On 4 mar, 13:02, cliff vaughn <[email protected]> wrote:
>
> > > > > > > > > have you tried just using the "order", or "orderby" property 
> > > > > > > > > in
> > > > your
> > > > > > mapping
> > > > > > > > > for the list?
>
> > > > > > > > > On Thu, Mar 4, 2010 at 5:49 AM, Marc Climent <
> > > > [email protected]>
> > > > > > wrote:
> > > > > > > > > > I have found some articles about this particular subject but
> > > > they
> > > > > > do
> > > > > > > > > > not solve what I want to achieve and I ran out of ideas.
>
> > > > > > > > > > Right now I have a kind of localizable field which is is 
> > > > > > > > > > stored
> > > > > > like
> > > > > > > > > > in <a href="
> > > > > >http://fabiomaulo.blogspot.com/2009/06/localized-property-
> > > > > > > > > > with-nhibernate.html<
> > > > > >http://fabiomaulo.blogspot.com/2009/06/localized-property-with-nhiber..
> > > > > > .>">this
> > > > > > > > > > article</a>, using a UserType that
> > > > > > > > > > serializes itself to a database field. This solution has 
> > > > > > > > > > worked
> > > > for
> > > > > > > > > > months but now a list must be sorted by a field of this type
> > > > and
> > > > > > the
> > > > > > > > > > table contains a lot of rows, so sorting by this field 
> > > > > > > > > > forces
> > > > us to
> > > > > > > > > > retrieve all the entities on the table to get the value of 
> > > > > > > > > > the
> > > > > > > > > > localizable string and sort them. That's pretty inefficient.
>
> > > > > > > > > > Another complexity is that an entity can have several of 
> > > > > > > > > > this
> > > > > > > > > > localizable properties so my idea was to create a couple of
> > > > tables,
> > > > > > > > > > one containing the reference to the entity and the field and
> > > > the
> > > > > > other
> > > > > > > > > > containing the values for each particular language:
>
> > > > > > > > > > Dictionary           |dict_id|entity_id|entity_field_name|
> > > > > > > > > > DictionaryValues |dict_id|locale_id|value|
>
> > > > > > > > > > This table structure can be mostly achieved as explained in 
> > > > > > > > > > <a
> > > > > > > > > > href="
> > > > > >http://www.webdevbros.net/2009/06/24/create-a-multi-languaged-
> > > > > > > > > > domain-model-with-nhibernate-and-c/<
> > > > > >http://www.webdevbros.net/2009/06/24/create-a-multi-languaged-domain-..
> > > > > > .>">this
> > > > > > > > > > other article</a>, but now I
> > > > > > > > > > need to establish the link with the entity id and the entity
> > > > field
> > > > > > and
> > > > > > > > > > I don't know how to do it using NHibernate in an elegant way
> > > > (i.e.
> > > > > > > > > > getting automatically the field name and looking for the 
> > > > > > > > > > right
> > > > > > > > > > entity_field_name in the Dictionary table and not having to
> > > > specify
> > > > > > > > > > the current culture id but getting it from the current 
> > > > > > > > > > Thread).
>
> > > > > > > > > > So, the thing becomes quite challenging for me right now and
> > > > I'm
> > > > > > sure
> > > > > > > > > > that some solution can be found with some help.
>
> > > > > > > > > > Any idea? (I promise a post on my blog whenever I find a 
> > > > > > > > > > good
> > > > > > > > > > solution).
>
> > > > > > > > > > --
> > > > > > > > > > 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]>
> > > > <nhusers%[email protected]<nhusers%[email protected]>
>
> > > > > > <nhusers%[email protected]<nhusers%[email protected]>
> > > > <nhusers%[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]<nhusers%[email protected]>
> > > > <nhusers%[email protected]<nhusers%[email protected]>
>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/nhusers?hl=en.
>
> > > > > --
> > > > > Fabio Maulo
>
> > > > --
> > > > 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.
>
> > > --
> > > Fabio Maulo
>
>

-- 
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