UPDATE:
I managed to implement a simple solution, thanks to the flexibility of iBatis:
Tables:
ADMIN.PROJECT(id, oracle_ts_name, etc.)
ADMIN.DATASET(id, project_id, name, description)
$oracle_ts_name$.DATASET_STRUCTURE(id, dataset_id, variable_name, variable_datatype, etc.)
$oracle_ts_name$.DS_001(cols are defined in DATASET_STRUCTURE)
...
$oracle_ts_name$.DS_XYZ(cols are defined in DATASET_STRUCTURE)
I simply have to provide tablespace property to the nested model objects:
--------------------------------------
selectDatasetsByProjectId:
Code:
SELECT
d.id,
p.oracle_ts_name oracleTsName,
d.name,
d.description
FROM
${admin.tablespace}.dataset d
INNER JOIN ${admin.tablespace}.project p ON (d.project_id=p.id)
WHERE project_id = #value#
ORDER BY d.id
And then the $substitution$ syntax can be used:
--------------------------------------
selectDatasetStructureById
Code:
SELECT * FROM $oracleTsName$.DATASET_STRUCTURE
WHERE dataset_id = #datasetId#
Everything works fine (including caching), but my next problem will be managing the DS_XYZ tables through Spring powered forms.
Any suggestion? (I can't change the DB structure
)
Thanks