I don't know if this model you are presenting is just an example or it's real.
For me I would put Name and Description in Article and extend Scotch from a new one "Beverages" but, models are models.
As Peter Cooper told me in the past one week or two, you can have a "calculated" field or initialize it with a specific value.
I use it do distinguish Customers from Supliers, from Person, from Employee, etc.
In Class Article you can define the field like this
property pClassName as %String[initialexpression={..%ClassName()}];in COS set o=##class(<Package>.<Class_Name>).%OpenId(some_id) write o.%ClassName()
go to the archives (http://www.xiscsp.co.uk/ngp) and enter "Data Selectivity" if you need to see the example.
Now Try to create a record in Scotch, Spirits, etc and look @ what class you want and you'll see this property.
Nuno
Korbinian Bachl wrote:
Hi,
im very new to cache and somehow find it very interesting how you can store data with it (compared to relational DBM's).
Currently we have all our Articledata within a mysql-DB in about 11 tables (this is because the attributes differy very) and I find it interesting how you can set this in objects and then define a child-objects that has all the attributes, eg:
Article: -> ID -> Price -> Weight ...
Scotch extends Article -> Destillery -> Origin ...
Spirits extends Article -> Name -> Description ...
Champagner extends Spirits -> Origin -> type (Brut, SemiBrut etc) ...
but what is then a good way to work with it ? i mean if sb. wants to search a product then all these clases and subclasses have to be searched - wich is quite the same overhead than at the moment when doing 15 SQL-queries for just 1 lousy search... can anyone give me a hint ho to put these things better together?
Also with the changing from MySQL to Cache we want to migrate from PHP to J2EE - (we need things that PHP lacks of, like MVC - seperation and I8N) and so i thought it might be best to seperate the data access into EJB's - is this a good idea or would this be more a bad aproach?
thanks for help,
Korbinian Bachl www.whiskyworld.de
