id : INTEGER
image_tablename : VARCHAR
search_attribute_1 : INTEGER
search_attribute_2 : VARCHAR
report_id : INTEGER
data : CLOB
So, we have a parent table REPORT, in which we have important data, extracted from the data CLOB into searchable columns on each row. Each row also contains a column image_tablename, that names which table, the data CLOB can be found in.
This design enables us to take complete image tables of CLOBs offline, without even moving rows around, having to be concerned about oracle watermarking issues, etc. But, having REPORT pinpoint the table where the data CLOB is, also makes it impossible to map with JPA. The @Entity annotation requires the table name to be set at mapping time.
Luckily, we could simply do a couple of native queries. One for locating the tablename on a report_id and one for getting the CLOB data from that table.