I have a somewhat similar situation; trying to create a CMA which associates metadata with data in an existing database, probably a database other than the one where the metadata is stored and which may be legacy, so may have composite primary keys,
The solution I've come up with so far is to use the fact that Hibernate likes to use a class to make up composite keys. So I have a "serializable" column on my metadata table which takes a serialized object, and an "entity" column that takes the name of the entity. Then I can simply do a session.load(entity, serializable) to retrieve the data.
It's nice in that it imposes no limits on the legacy database; but I haven't got as far as working out what the cost is in performance terms. Potentially quite a lot, I fear!
|