Hibernate how to implement dynamic data structure

Viewed 1085

I have this massive data structure - I would like to avoid specifying class for each type...
Using hibernate, can this structure be implemented in such way that when adding new species or foreign key - no recompilation will be needed?

Animal
|
    Birds
    |   Parakeet 
        |   Love Bird  -> [one to many:visit record]
        |   Budgerigar -> [one to many:visit record]
    Mammals
    |   Dog -> [one to many:vaccinations] [one to many:visit record] [one to many:Haircuts] 
    |   Cat -> [one to many:vaccinations] [one to many:visit record]
    |   Horse -> [one to many:vaccinations] [one to many:Horse breeding]


Tree is about 100+ types of animals

So for example -

Example1:I can add additional type without recompiling the code

     | Cow -> [one to many:vaccinations] -> [one to many:pregnancy dates]

Example2: ability to Create dynamic links between entities

    |   Horse -> [one to many:vaccinations] [one to many:Horse breeding]
            LinkToOwner->   [one to one: owner]
2 Answers
Related