Ok, i will respond myself to my problem, as usual on this forum:
The implementation of Criteria is a little poor.
There are Top level criterias, known as CriteriaImpl and subcriterias known as CriteriaImpl.Subcriteria....
there should not be any problem with that, but:
ALL the subcriterias you create on that CriteriaImpl, no matter they are Subcriterias of other Subcriterias, they ALL are stored in a list, no matter the adding level - so, you have to itere trought the list until you get tired of it.
Same issue is at the criterions stored...you cannot get the criterions for a subcriteria for example, unless you iterate like a maniac trough them... :(
As like this wasn't enough, there's more:
public Iterator iterateExpressionEntries() { --> Should be called iterateCriterionEntries -> it does a lot of confusion, because it returs
criterionEntries.iterator();
The last, but not the smallest:
you have a private Map fetchModes = new HashMap();...well..there's no accessor method for this...but, there are accessor methods for the elements inside the map :
public FetchMode getFetchMode(String path) {
return (FetchMode) fetchModes.get(path);
}
Maybe some of you will say this is unnecessarely...what if i want to convert my criteria into an xml and then back?
|