I guess you can have ImageCategoryLink class that will be simple class like
Class ImageCategoryLink {
Category category;
Image image;
}
And then simply retrieve necessary images by HQL like
“from ImageCategoryLink icl where icl.category.id = ? order by icl.image.name”
or
“from ImageCategoryLink icl order by icl.category.name , icl.image.name”
or
“from ImageCategoryLink icl order by icl.image.name , icl.category.name ”
and mapping of ImageCategoryLink is simple many-to-one
http://www.hibernate.org/hib_docs/v3/re ... -manytoone