Hello experts, I tried this question in other forums, no reply yet. I believe this is the best place to check my concern.
Trying to understand the design of Hibernate at the core level, got one concern while going through collection references. please provide comments, may be corrections in my thought of course.
If my organization is well 'package established', it means that all my domain objects have been well built with proper encapsulation and highly cohesive in nature and 'package'd well with beautiful hierarchies. Thus, any further software/application design may use these templates (classes) to build its own design, may be messaging, may be database and may be something big or small, whatever app my company needs. If Hibernate has to use these structures, it seems an issue there because any relations has to be defined inside these classes, like Set for multiplicity. So, in such case of my company, for hibernate I have to extend all required classes to build H_classes for each, which can accommodate its specific collections as per what database needs to hold relations. So, this means, Hibernate cannot generate relation objects dynamically as needed ?
To explain what I think, I expect as the cool feature of an ORM to reduce dependency further with this below is example.
As of the design, if Course(1) is related to Student(N), hibernate needs a Set of Students to be defined inside Course class, not sure I am thinking in wrong way, here we are actually changing the behavior of Course with respect to database, means a design issue ? it means, if something new comes up for Course, like many Colleges teaches the Course, we add Set of Colleges to Course class again ? thus keep on updating Course class as needed ? Instead, if once mapping is defined on the relations, can't hibernate generate these class definitions and object dependents dynamically so that no matter any number of relations Course has, Course will just remain with its details only instead of these specific Sets inside. Now, can ORM generate dependent relation classes like Course_Student, Course_College and its objects and populate associations internally as per database rows from mapping table and populate / update them as required by user? will this be more dynamic ? In this case, I can just use my well defined domain objects directly to ORM without these internal collection mappings since during runtime my ORM generates and maps relations with base objects.
|