-->
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.  [ 4 posts ] 
Author Message
 Post subject: Use of map-type attribute in queries
PostPosted: Thu Apr 03, 2008 3:21 pm 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
Hi!

I've been testing this query:

select item from Item item
where item.translatedDescription.translationValues[:language].value LIKE %:text%
or
item.translatedName.translationValues[:language].value LIKE %:text%

It's strange but it just retrieve results for the second expression. I mean, it never find an object in item.translateDescription.translationValues[:language].value

However, when I try whith a query that just have the first expression, like this:
select item from Item item
where item.translatedDescription.translationValues[:language].value LIKE %:text%

it retrieves results. Any idea?

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 04, 2008 11:17 am 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
More strange. If i add a close bracket at the end of the first expression, the query returns results for matchings found for the first expression, but 0 results for the second expression:

select item from Item item
where item.translatedDescription.translationValues[:language].value LIKE %:text% )
or
item.translatedName.translationValues[:language].value LIKE %:text%

It seems like a parser problem...does anybody use maps -more than once- in HQL queries?

Thanks a lot


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 05, 2008 5:18 am 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
More exact, these are my classes:


@Entity
@Indexed
public class Ficha {

@Id
@DocumentId
private Integer id;

@IndexedEmbeded
private Translation translatedName;

@IndexedEmbeded
private Translation translatedDescription;
....

...
@Entity
@Indexed
public class Translation {

@Id
@DocumentId
private Integer id;

@IndexedEmbeded
Map <Language, TranslationValue> translationValues;
....
...
@Entity
@Indexed
public class TranslationValue {

@Id
@DocumentId
private Integer id;

@Field(index=Index.TOKENIZED, store=Store.NO)
String value;
....

@Entity
@Indexed
public class Language {

@Id
@DocumentId
private Integer isoName
....


and the query:

select ficha from Ficha ficha

where ficha.translatedDescription.translationValues[:language].value LIKE %:text% )
or
item.translatedName.translationValues[:language].value LIKE %:text%

It never returns matchings for the first expression. However, if add a close bracket at the end of the first expression, it returns results. Could be a parser bug?

Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 05, 2008 12:50 pm 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
I ment that the query is:

select ficha from Ficha ficha

where ficha.translatedDescription.translationValues[:language].value LIKE %:text%
or
ficha.translatedName.translationValues[:language].value LIKE %:text%

Could anybody test that query please?? It's very important.

Thanks.


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