Hibernate version: 3.1
Mapping documents: N/A
Code between sessionFactory.openSession() and session.close(): N/A
Full stack trace of any exception that occurs: N/A
Name and version of the database you are using: Oracle 9.2.0.6
The generated SQL (show_sql=true): N/A
Debug level Hibernate log excerpt: N/A
I have a Hibernate Best Practices question.
We have two tables in our application, where the first table contains a group code and serves as a parent with a one-to-many relationship to a child table that contains type codes. So it is one group code to many type codes. Throughout the application, the group and type codes are used as attributes of other domain objects. For e.g, we may have a Brand object which has a manufacturer type code as an attribute. We have separate classes for the two tables and Hibernate mappings for each.
My question is if it possible to have Hibernate mappings with a permanent filter based on the group code, for each object that needs a separate class. For e.g. if the manufacturer type code above needs to have its own class instead of coming from the generic type code class, can we have a Hibernate mapping that maps to the manufacturer code class with a filter indicating that the group code is always the Manufacturer group code?
We are told by our Architecture group that this type of mapping is "fragile" and they prefer to have a separate table and mapping for each type code, instead of trying to re-use the common set of tables. What exactly do they mean by "fragile" and what are the pros and cons of doing such a mapping?
Would appreciate any speedy replies. Thanks in advance.
|