komalbansal1991 / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

Search Function for Collection - Map #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Quick question: does the framework support search function on Map type 
property, for example, we have an entity A which has a property Map<String, 
String> m, then I want to filter A base on the key of the map m, is there a way 
to do it, I tried m.key, but it didn't work. I searched the posts here, and it 
says "Filtering on collection properties with SOME, ALL, and NONE is 
implemented in 0.4.2.", but are they only for List type?

If I post this in the wrong place, please correct me, I haven't found any other 
place to post question, sorry in advance.

By the way, it is an awesome framework, especially the search function, one of 
my favorite frameworks now.

Thank you very much.
RetRo

Original issue reported on code.google.com by RetRo.Li...@gmail.com on 6 Oct 2010 at 1:35

GoogleCodeExporter commented 9 years ago
No I don't think think the framework supports this yet. HQL does apparently 
support it as follows:

"You can use HQL built-in function: index() eg.

select item, index(item) from Order order 
join order.items item
where index(item) = 'foobar'

where order.items is Map"
-- http://forum.springsource.org/archive/index.php/t-32224.html

By the way, the best place to post questions is here: 
http://groups.google.com/group/java-generic-dao. That's the discussion group 
for the framework. But I'll leave this here since it's a good feature 
suggestion.

Original comment by dwolvert on 6 Oct 2010 at 1:03

GoogleCodeExporter commented 9 years ago
Developer note:

Use ".index" just like ".size". But maybe both of these need to be adjusted so 
they don't step on legitimate properties "index" and "size".

Original comment by dwolvert on 7 Oct 2010 at 1:30

GoogleCodeExporter commented 9 years ago
I will try it out, thank you so much, it would save me a lot of work if it 
works.

Original comment by RetRo.Li...@gmail.com on 9 Oct 2010 at 3:55