I would like to create dynamic and generic superclass with JPA/hibernate that will be extended for each hierarchical structured model like: role, page, directory, department, permission, tree. I would like to create with this object dynamic tree using recursion and java reflection
it should look this way:
This entity should have reference to self entity.
I would like it to be completely abstract and had no db table. Only extendet enities should have db.
I've tried to achive this. But fail so long. Here is my post about it
I consider solutions:
- @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
- @Any and @AnyMetaDef mappings
- @MappedSuperclass
- @Embeddable and @Embedded
I hope someone will give some suggestions.