If people are in agreement, I would like to address some proposed issues relating to Hibernate from the wiki/notepad page:
How to extend an OpenMRS object
How to set up a relationship with an OpenMRS object
How to do subclasses correctly
These are of current interest to me due to the following use case:
1. The current Order object does not have a column for urgency ("stat" orders)
2. The current Order object only allows for a single specimen per order, when there are cases when multiple specimens must be taken for a single order
I believe this issue has previously been addressed in https://wiki.openmrs.org/display/docs/Extending+a+Table+Through+a+Module but I find this hard to comprehend (perhaps because it is too specific to the Encounter use case). Also, it appears that it supplants the core Encounter table with a module-defined Encounter table. I am concerned that this may not be the best practice because it means that other modules cannot also extend Encounter.
I have been thinking in terms of two tables, one which would be an auxiliary orders table that would contain the urgency field and have a 1-1 relationship with orders, and the other of which would be a relationship table that would relate orders table rows to 0:n specimen rows. I would prefer to leave core blissfully ignorant of these tables. My questions:
(1) What are the right Hibernate declarations for these tables?
(2) How much of the audit info should be included in each table?
(3) Is it a good idea to write the DAO layer so that the two tables appear as a single table or should only the methods associated with the auxiliary table be addressed?
(4) How should the save be handled?