For a GIS-Mapping application, Id like to generate an Hibernate mapping.
in run time .
The reason is that one class (Layer) may have many different attributes (LayerAttribute).
For example:
a Layer River has Name, m3, length, lineGeometry. They are saved in River's table.
a Layer Country has Name, m2, countryCode, polygonGeometry. They are saved in Contry's table.
The easy solution (to create a Country class and a River class, and map them) doesnt work. I need to has one class (Layer) whose instances could dynamically descover its properties (by its relationships with a LayerAttribute class). The reason is that I want to add or replace data to system without reboot it or create new classes.
Id like to get two instances of Layer (riever and country) which read their data from two diferent tables.
Classes are like this:
class Layer{
private Set layerAttribute;
}
class LayerAttribute{
String name;
Class dataType;
Object atributeInstance;
}
Can I change in runtime an Hibernate class mapping? Is it an Hibernate feature, or must i look for it in cglib?
Regards!!!!
|