kevoree-modeling / framework

The Kevoree Modeling Framework
http://modeling.kevoree.org
GNU General Public License v3.0
42 stars 6 forks source link

Creation of index could erase an existing index without warning/error #21

Open lmouline opened 8 years ago

lmouline commented 8 years ago

Let us have a simple example :

class kmf.test.Personne {
    att name : String with index
    att firstname : String
}

If we create a person p1 (Name1,FirstName1) and after we create a person p2 (Name1,FirstName2). The second one will erase the first one, without any warning/error. So the findAll result will contain only p2.

dukeboard commented 8 years ago

Yes at the moment the choice in KMF was to allow transparent refactoring (rename) of elements without errors, in particular because we never know if the key is already complet (sequence of call to setAttribute). Therefore, i will let this discussion open for two weeks in order to collect more feedback if any.

maxleiko commented 8 years ago

It might be useful to prevent creation if there is already an item with the same index in the collection.
If one does not care about updating automatically, then KMF could provide an update method. (or actually a createIfNone())
Anyway, if KMF express this concern in its DSL, it could be great.