gist JS

Wednesday, September 27, 2006

Hibernate cannot dereference scalar collection element

You're getting this because nobody told you about the secret little hibernate 'elements' and 'indices' functions. Yes I know there's 1001 tutorials/books/etc on how to creating a mapping file with lists or sets or maps. But no, no of course it wouldn't be usefull to put in said tutorials a small hint as to how one actually queries these collections.

from the hib docs:
from Player p where 3 > all elements(p.scores)
from Show show where 'fizard' in indices(show.acts)


Bill said...

yes, you are right: I can not find any document about it.
Could you please explain a litter more about how to use it?

jdwyah said...

Hibernate docs chapter 14.9.

"HQL functions that take collection-valued path expressions: size(), minelement(), maxelement(), minindex(), maxindex(), along with the special elements() and indices functions which may be quantified using some, all, exists, any, in."

It seems works like you might expect. Indices gives you you map keys and elements the values, then you pick the appropriate modifier from some, all, etc, and apply your condition. Do you have an example of what you're doing?

Anonymous said...

Thanks Jeff. Very usefull.
-- dara

Anonymous said...

Thanks for this hint. I found the solution here, not in Hibernate docs.

John Alert said...

Great step by step solution, thanks for the help!

Spring Hibernate Online Training | Hibernate Training in Chennai Java Training Institutes

Hibernate Online Training | Java Online Training | Java EE Online Training

Nandhini said...

Amazing blog about the various informative information on the programming languages.... Web Designing Training in Chennai

sudha P said...

I am definitely enjoying your website. You definitely have some great insight and great stories. 
Selenium training in Chennai

Selenium training in Bangalore

sasitamil said...

I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing..
Believe me I did wrote an post about tutorials for beginners with reference of your blog. 

Selenium training in bangalore
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training

Murali said...

Blue Prism Training
Blue Prism Training in Chennai | Blue Prism Training in OMR
Blue Prism Course in Chennai | Blue Prism Course in OMR
Blue Prism Training Institute in Chennai | Blue Prism Training Institute in OMR
Blue Prism Certification in Chennai | Blue Prism Certification in OMR
Blue Prism Training Institute near me