T
timasmith
So I have a patient database object
create table patient (
patient_id number primary key,
patient_name varchar(40),
birth_dt date,
etc.
)
I have an equivalent java object auto generated from the database table
above.
I also have an auto generated patientList object which collects patient
objects and also implements the abstratTableModel which allows me to
automatically populate the GUI JTable and gain wonderful cheap
functionality.
This worked great but now I want to logically extend the patient table
allowing custom fields at that patient level. This seriously breaks
fouls auto generation of the implemented abstractTableModel - since the
fields cant be determined until runtime from the database.
create table custom_fields (
custom_fields_id number primary key,
related_table_ref_id number,
related_primary_key_id number,
custom_column_id number,
column_database_type number,
int_value number,
double_value number,
date_value date,
string_value varchar2(2000),
long_value long
)
Passing patientLists around was intuitive and one thought was to have a
collection of custom fields owned by each Patient Object - but since
they are generated at runtime I have to look them up, add to *every*
Patient Object and add to the Patient List object. Obviously I do not
want the objects/lists to be aware of the database.
Cant say the whole challenge of custom (logical) fields is an
enterprise pattern I've read about but there must be many common
solutions to architecting the best way - both for the database table
and the objects to represent them.
Any help gladly appreciated.
Tim
create table patient (
patient_id number primary key,
patient_name varchar(40),
birth_dt date,
etc.
)
I have an equivalent java object auto generated from the database table
above.
I also have an auto generated patientList object which collects patient
objects and also implements the abstratTableModel which allows me to
automatically populate the GUI JTable and gain wonderful cheap
functionality.
This worked great but now I want to logically extend the patient table
allowing custom fields at that patient level. This seriously breaks
fouls auto generation of the implemented abstractTableModel - since the
fields cant be determined until runtime from the database.
create table custom_fields (
custom_fields_id number primary key,
related_table_ref_id number,
related_primary_key_id number,
custom_column_id number,
column_database_type number,
int_value number,
double_value number,
date_value date,
string_value varchar2(2000),
long_value long
)
Passing patientLists around was intuitive and one thought was to have a
collection of custom fields owned by each Patient Object - but since
they are generated at runtime I have to look them up, add to *every*
Patient Object and add to the Patient List object. Obviously I do not
want the objects/lists to be aware of the database.
Cant say the whole challenge of custom (logical) fields is an
enterprise pattern I've read about but there must be many common
solutions to architecting the best way - both for the database table
and the objects to represent them.
Any help gladly appreciated.
Tim