Hi.
Please excuse my english.
This question seems to have no answer in forums nor wiki:
* We currently have a product (not Hibernate based) which manages inventory. We do it by modeling "inventory items" in an OO way:
we have 'item classes' which define what attributes an item must have (for example, a "printer" must have 'resolution', 'interface type', 'cartigde reference', etc)
we have "container classes" that can also have attributes (ex: a "building" must have an 'address') but whose main purpose is to serve as containers for various items and or other containers.
We then establish relationships between "item" objects (say, printers, cpus) and "container" objects (say a site, a building, a city...). We create a hierarchy with "cities", "sites", "subsites", "items" etc, for one to know "where is what" in a very flexible way.
The logic for manipulalating this hierarchy, creating new "items", changing items attributes, putting items and containers inside other containers resides in separate packages which we call "business rules"
So far it might sound very applealing candidate produt to migrate from its current JDBC+SQL mess to a new and elegant hibernate implementation.
However, there is an issue:
We must offer the ability to extend the model by creating new "classes of objects" (classes of items).
This way our customers can create a new class of items (say "USB flash storage") with attributes (say 'capacity', etc ) and then be able to create new instance "items" of that class (say: Flexar with 256Mb, serial #xxx), and have those "items" interact with other objects (put the USB 'item' in a "depot" container, etc).
It is very important that our customers can create those new classes of items, and use items of those new classes at runtime, and with no "developer intervention" and no need to restart the application. Thats the feature what sells our product.
Currently, our implementation is a monster of SQL and "query builder functions" that creates a new database table for every new class the user creates (featuring one column for each attribute the user declares, and other stuff), and manages item creation/modification/deletion as inserts/updates/deletes in those tables. It also generates, compiles and loads java source code of objects that feature the desired attributes, can be persisted by the SQL_monster and at the same time can be used by the bussiness rules packages. It works, but it is slow, ugly and will not scale.
Also we would love to be able to persist "real" objects, containing the bussiness rules within themselves, instead of these "groups of attributes" we currently use.
But it is one thing to persist objects, and another thing to allow dynamic extension of the list of persistable object types.
My question is:
|