[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Teneo/Hibernate - key conflicts

There's no way around the issue that keys must be unique, so at most one can be null.

Martin Taal wrote:
Hi Josef,
Yes setting the id to null should let the database/hibernate generate a value.


Yes afaiu the keys value should be unique and there are two objects which have a value null for the key. I am not sure how this can be overridden or prevented in EMF.

Hopefully Ed can help out here with some tips & tricks.

In the meantime can you give some background info/content when this diagnostic error occuring? (saving a resource or are you validating explicitly).

gr. Martin

Josef Duschl wrote:
Hi,

in my model I have an abstract superclass which serves the unique id for all objects in the model. I have the generator annotations from http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg41996.html in place at the package and the id field. The cardinality of the id field in the super class is 0:1 - it is optional. So basically I should be able to leave it blank and it should be generated when the objects are stored to the database, correct?

Now to speed things up, I've set the id, mentioned above, to be the key for every reference in the model. I've used the keys property of the references to do this. This leads to diagnostics of this pattern:

The feature 'objects' has key [uniqueId=null] for 'model.impl.ObjectImpl@1e45641{hibernate://?dsname=ModelStore#//@objects[uniqueId=null]}' which collides with that of 'model.impl.ObjectImpl@1f1779e{hibernate://?dsname=ModelStore#//@objects[uniqueId=null]}'


Is there any way to fix this without loosing the performance gained from having an index in the database for the references?


Kind regards,

JD