Hi micheal,
 
    This is regarding the fix u'd mentioned for persisting extended classes.

             /* adjust priority if there are extendent classes */
             if (_extendent != null) {
               for (int i=0;i<_extendent.size();i++) {
                 maxPrior = Math.max(maxPrior, ((ClassMolder)_extendent.get(i)).getPriority());
               }

             }
Its all about considering the extending classes also for determining a class's priority. The workaround is that - the priority of a base class is made greater than the maximum of pririty of its related classes AND maximum of the priotities of its extendents.
Consider the following simple model:
 
"AccessCode" depends on "User" depends on "Department" depends on "Hospital".
 
Both "Doctor" and "Patient" extends from "User".
 
We have to create a Hospital containing a Department containing a Doctor having an AccessCode.
 
Getting the proiorities,
 
a) Hospital will get a priority of 0, as it has no connection with any other object - correct
 
b) Department will get a priority of 1, as it has connection with Hospital which has a priority of 0  - correct
 
c) AccessCode will get a priority of 3 as it depends on User which has a priority of 2 because User connects to Department which has a priority of 1 (max priorities of its extending classes Doctor and Patient will be ignored as both have priorities 0 which is less than 2) - correct
 
d) Priorities of Doctor and Patient will still remain as 0 and as a result, Doctor object will be created before the Department - WRONG !!!.
 
We also had thought of forcing the extending classes to inherit the same priority of its base class, but again we had some other problems with that also. 
 
We could make it work using this patch only by tweaking the domain model so that instead of User having connection with Department, connect both Doctor and Patient to the Department.
 
Any suggestions?
 
Regards
Arun

Reply via email to