Hello,
Advice is sought as to the best practices of application design with Hibernate. I have classes that represent persistent objects. Classes (java files) are generated from the mappings, and the database structure is also generated from the mappings.
I need toi implement certain functionality pertaining to each class/object. For example, a persisted parent contains a list of children. The Application should be able to find easily a certain child and perform some operations on it (such as remove, update, sort, etc etc.). The logical way of doing this is implement a method in the Parent class that will do all the work. However, it would involve the manual modification of the mapping class, and therefore the auto-generation of java files from mappings will involve copy-paste work each time (I'll have to move the methods to the newly generated java files). Besides, this approach is a bit against the whole Entity paradigm. The classes are supposed to be minimal, as they represent the object themselves, and do not contain business logic.
Is there a better way of solving this problem?
Thanks for your suggestions.
|