I'm using this approach described here
http://www.siimviikman.com/2010/02/24/mapping-translations-in-nhibernate/
. 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]>
> > > .
> > > 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.

Reply via email to