I have this HQL query
Code:
select item, translation from Item item, ItemTranslation translation
where item.id = translation.item.id
This works fine and I get both the Item class and the ItemTranslation class.
In my annotation mapping the Item class is not aware of the ItemTranslation class. The ItemTranslation class is howerver aware of the Item class.
This is because I like to separate the translation from the item. The ItemTranslation class must check Language, Store etc. When this query is executed I get a collection of objects.
Code:
Query q = session.createQuery("from item, translation from Item item, ItemTranslation translation
where item.id = translation.item.id");
Iterator pairs = q.list().iterator();
while ( pairs.hasNext() ) {
Object[] pair = (Object[]) pairs.next();
Item item = (Item) pair[0];
ItemTranslation translation = (ItemTranslation) pair[1];
}
The only thing I want from the ItemTranslation class is name and description.
My question is if I can get only the Item class with the ItemTranslation name and description. The Item class has a name and description field that is marked transient.
I want a Item class with it's name and description populated with ItemTranslation name and description. Is this possible?