Hi,
i've the following three classes:
Feature - eg. "weight", "HDD Capacity", "clock rate"
FeatureCategory - every feature is associated with one category for grouping them in the GUI. eg. "Main Features", "Misc"
ProductType - every productType has some specific Features. "Notebook", "Display"
I'd like to recieve the featuresCategories with populated List of features. But only this features which are specified for a ProductType.
Notebook --> HDD Capacity, clock rate
Monitor --> weight
this is my idea:
Code:
Criteria crit = getSession().createCriteria(FeatureCategory.class)
.setFetchMode("features", FetchMode.JOIN)
.createCriteria("features")
.createCriteria("productType")
.add( Expression.eq("id", 10 ) );
return new HashSet(crit.list());
It works, but returns me always the whole list of features, not the specific ones for productType = 10.
Any ideas?
Thanks in Advcance,
Patrick