-->
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.  [ 3 posts ] 
Author Message
 Post subject: Reading values dynamically from mapping file
PostPosted: Tue Oct 16, 2007 1:57 am 
Newbie

Joined: Tue Oct 16, 2007 1:29 am
Posts: 3
How can I read dynamic values from a mapping file?

Purpose: I need to read the locale from the system. The mapping file contains mapping for two tables one which has the description and id and the other table has the languages associated with that id.

For eg, if an id has French language associated with it then the French user should be able to see French description for that id. Then if US or any other user wants to see the description for the same id then it should show in English(default).

I just want to use session.createQuery("from table") while retrieving data. Right now I am using the <formula> tag to read the locale dynamically in the mapping file. But it seems not to be working.

The other problem with session.createQuery("from table") statement is, it is not doing a left outer join on the tables. But if I use session.load(Table.class) method then while loading class it does an outer join as there is a mapping for this in the hbm.xml file. How can I achieve this in createQuery method?

Please let me know if any body has any answers for these.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 16, 2007 9:04 am 
Newbie

Joined: Tue Nov 28, 2006 4:34 am
Posts: 5
Code:
session.createQuery("from Table1 table1 join table1.table2s table2")
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 16, 2007 10:33 pm 
Newbie

Joined: Tue Oct 16, 2007 1:29 am
Posts: 3
Thanks.

I actually dont want to use the join inside the query as I am also getting the table name dynamically. So, I wouldn't be knowing what table it is associating with in the mapping file.


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