Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hi all,
For sometime I've been trying to write an HQL query that is obtaining a map value based on some key in this map (without loading the entiry java.util.Map object).
Here is the real situation:
Having an I18NString as an entity that contains a map - using map element in hbm to map the java.util.Map object - index is from type java.util.Locale and the element is from type String.
I'm trying to obtain only the string from I18NString object that is from particular locale.
here is some tables :
I18NString
i18nstring_id
I18NString_Value
i18nstring_id - foreign key to I18NString table
locale - contains the locale
value - containst the string representation for this locale.
The idea is to obtain only the string that represent this object in some particular locale: something like this (note that values is the java.util.Map)
select i18nstring.values['en_US'] from I18NString i18nstring where
i18nstring.id = :i18nstringId
of course this query doesn't work (that's why I'm searching for help :) )
So my question is : Is it possible to create such HQL query or the only option that I have is to use native query ?
Thanks for your help in advanced.