Hibernate version: 3.0
I'm trying to find a way to map multiple classes with a Map property to a single lookup table with Hibernate, and I think I'm just missing something simple but I can't get it to work as I expect.
What I would have are a couple of classes like
Code:
class my.Foo {
Map<String,String> meta;
}
class my.Bar {
Map<String,String> meta;
}
and my goal is to be able to use a single Map table like
Code:
create table meta {
varchar(255) clazz,
varchar(128) mkey,
varchar(255) mvalue,
primary key (clazz,mkey)
}
where the clazz column is meant to hold the class discriminator values "my.Foo" and "my.Bar". I was hoping Hibernate could be configured to automatically populate the clazz column with the property's parent class name and thus present a simple Map<String,String> from the application's point of view.
Is there a simple way to accomplish this?