-->
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.  [ 6 posts ] 
Author Message
 Post subject: on the fly joining of dictionary fields
PostPosted: Wed Feb 22, 2006 11:07 am 
Newbie

Joined: Thu Feb 09, 2006 5:51 am
Posts: 9
Hi,
I have a huge dictionary which I cannot allow to load to the client.
(i.e. ID, VALUE )

and I have objects which use it
(i.e. OBJ_ID, DIC_ID, ......, )

what I want to get is ( ID, VALUE, ... ) that is join the dictionary value into the object.

I don't really want to create a dictionary entity and have a many-to-one realationship to it.

Is there a way to map the dictionary value directly to, say, string field of may class?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 22, 2006 11:49 am 
Regular
Regular

Joined: Tue Mar 15, 2005 12:38 pm
Posts: 73
Location: Bucharest
I don't know about a way to map this but if there is than how you would persist dictionary changes.

I would use select new() HQL queries to get just the needed data. And map as master - detail.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 23, 2006 5:24 am 
Newbie

Joined: Thu Feb 09, 2006 5:51 am
Posts: 9
I get that stuff from external source and cannot modify it therefore I do not need to change the values


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 23, 2006 5:33 am 
Regular
Regular

Joined: Tue Mar 15, 2005 12:38 pm
Posts: 73
Location: Bucharest
So, if I understood you have two tables already filled (object and dictionary).
Than map each of them as entities and than query like:

session.CreateQuery(
@"select new Pair( o.Id, d.Id, d.Value )
from Object o left join o.DictionaryValues d")
.List();

this way you get a lists of Pair objects.

You have to import the Pair definition in the mappings:
<import class="myasm.Pair, myasm" rename="Pair"/>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 4:34 am 
Newbie

Joined: Thu Feb 09, 2006 5:51 am
Posts: 9
And what type will be the returned result?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 4:39 am 
Newbie

Joined: Thu Feb 09, 2006 5:51 am
Posts: 9
uh sorry =) just understood its a list of pair objects


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.