30/6/2003
Debugging 


1- mistyped the discriminator-value in Party (= instead of -) leading to null discriminator error.


2- class cast, tree map requires a comparable . Diagram does not indicate classes inherit from comparable.
changed Part.telephones to hash set.


3- changed the search string from xgmed.domain to xgmed.domain.accountability in TestSession.

4- many - to -many bug: not working when changed to accountability package for party and telephone.
	1) not working when changed java Collection to Set  for party.telephone
	2) no - lazy to false - gets NullPointer when Comparable ( id not set?)
	3) reversing readonly

	re-wrote and seemed to work, probably mapping problem


5 - complex query AccountabilityType PartyType problem 
	- not a hibernate problem
	- problem with parameter passing in test code, mixed up commissionertype with doctortype instead of patienttype (inadvertently swapped the parameters because they were of the same type).
	
	

6.  3/7/03 -  Phenomenon is many-to-one bidirectional related to PhenomenonType; needed to remove
the table attribute from the set role="phenomenons"  of PhenomenonType, and made the key column attribute of the set the same as the class name, PhenomenonType, then the many-to-one mapping xdoclet tag in 
Phenomenon.java seemed to work.

7. aarrggh - 	xdoclet bug - how did someone manage to run something within a comment output?
		- temporary fix - run , ant the build will stop inside xdoclet.hibernate.ddl.
		- edit the build/class/xgmed/domain/planning/resource/hibernate-properties-ResourceAllocation.hbm.xml file, and move that closing comment to the right place (it's obvious if you have a 
		parsing - highlighting editor like vi). 

	fixed - compiled xdoclet 1.2b  and its modules and copied new jar files to lib.
	now need to see what the new xdoclet hibernate module can read.

	broken - the new xdoclet doesn't load the add-on custom hbm mappings. 
		-temporary fix ;  used old xjavdoc and hand edited the nested subclass parsing problems.
		-? in the documentation how to merge with new xdoclet.
		

8. package organziation - the classes were organized into conceptual packages, but hibernate doesn't cope
with inheritance crossing packages e.g. Party could be an Asset and Observation could be a Action.
Need to try to keep inheritance within the same package.
		-manual fix. Since the old hibernate worked better, I used that
		- the manual fixes are:
			1. move the end comment marker in 
				build/class/xgmed/domain/planning/Action.hbm.xml
				build/class/xgmed/domain/planning/resource/ResourceAllocation.hbm.xml
			so that the xml is well-formed.

			2. insert the old Party.hbm.xml~ into Asset.hbm.xml , changed the tag to subclass
			and make a Party inherit from Asset (but not all parties are bookable asset. Is
			this a case of "IS_A" overkill? Probably, every patient now turns up in the asset
			table. )
			


9. TimePeriod class had an attribute called "end" which is not allowed in postgresql sql. Changed to "finish"

 
10. don't put any (action.)hbm.xml files in the custom_hbm because ant copies it into the build/class directory,
and then it is read as a duplicate action.hbm.xml file.

11. Before running any scripts to copy hbm.xml files , make sure the file changes are recorded
in the custom_hbm or updated in the generated_hbm. 
e.g. Action.hbm.xml didn't have a many-to-one association declared for observation subclass to
Party , and this was lost when ant was run ( it was only in the build directory's Action.hbm.xml but
not in either custom_hbm/hibernate-properties.Action.xml or in generated_hbm/Action.hbm.xml
 )

12. Coding in IdentityObservation doesn't want to persist.
	? fixed

	
13. TestAccountability  multi person multi phones :  in createPersonWithMultiTelephones putting a transaction around
	the telephone colleciton iteration and save seems to make sure all telephone numbers are saved.
	
14. one-to-one bidirectional mappings not easy : identity needs to be the same.
    so tried many-to-one on both ends and seemed to work. e.g. IdentityObservation (see Action.hbm.xml) and Coding.
    
15. Using Visitor to save a object tree. After calling accept on a composite object, need to call the session.connection().commit()
to save more than one object , it looks like. (when this is omitted, only one telephone was saved, in TestAccountabilityParty.testMultiPersons).

16. Duplicate save: createOnePerson was saving a person before returning to creatPersonWithMultiTelephones , so TestPatientRegistration
was not matching the patient retrieved .

17. Observations not retrieved. Making the set role in Party for observations in the hbm file read only meant the observation wasn't
being saved, so set readonly="false"

7/7/2003
18. Double party saving when observations are added to an already persisted party. Hibernate 1.2 saveOrUpdate will save even if the
party already has an id. Added code in SaveSession visitor to check for existing id, and to call session.update( object) instead of save().

15/7/2003 
19. cascade errors : tried to make a saving visitor to visit the object graph, but just interferes with hibernate mechanism
Make sure that the hbm files have appropriate cascade annotations when needed e.g.
for party.observations  measurement.quantity  

20. cascade in compoundUnit.atomicUnit and compoundUnit.inverseUnit doesn't work during the creation method of
test_measurements for compoundUnits because can't associate one unit with 2 collections in seperate compoundUnit objects
in the same session.

21. when changing hbm files, remember to set schema-export on , when running Test cases.




