Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336480

Summary: DefaultTransientValueService: Consider derived features as transient
Product: [Modeling] TMF Reporter: Karsten Thoms <karsten.thoms>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: moritz.eysholdt
Version: 1.0.1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:

Description Karsten Thoms CLA 2011-02-07 04:19:16 EST
The DefaultTransientValueService should also return true for isTransient is the feature is derived.

	public boolean isTransient(EObject owner, EStructuralFeature feature, int index) {
		return feature.isTransient() || feature.isDerived() ||
Comment 1 Moritz Eysholdt CLA 2011-02-07 04:27:03 EST
why would you want that? I think the derived-flag should not have an impact on serialization... If a derived features should not be persisted, one should mark it as "transient" in Ecore.
Comment 2 Karsten Thoms CLA 2011-02-07 06:44:50 EST
Use case: My customer defines his metamodel in UML (don't argue here!) and uses the UML importer to create the Genmodel. There is no way here to mark features transient, but some relationships are marked as derived, since this is actually what is needed (and transient does not hit the intention also). And this setting is transformed to EMF with the importer.

Counter-question: Why should a derived feature ever be persisted? Which negative impact would it have to adjust the DefaultTransientValueService.
Comment 3 Moritz Eysholdt CLA 2011-02-07 08:13:32 EST
(In reply to comment #2)
> Use case: My customer defines his metamodel in UML (don't argue here!) and uses
> the UML importer to create the Genmodel. There is no way here to mark features
> transient, but some relationships are marked as derived, since this is actually
> what is needed (and transient does not hit the intention also). And this
> setting is transformed to EMF with the importer.

It's just that "derived" has noting to with "transient". If it would mean the same, there would only be one flag in EMF ;) 

That customer is free to register his own TransientValueService in which derived features are considered as transient. 


> Counter-question: Why should a derived feature ever be persisted? 

If you define an Xtext grammar for an Ecore model that has been generated from XSD. Then, EMF generates feature-Maps to preserve the order among values that belong the different features. Therefore, all features in the EClass except for the featuremap are marked derived. Xtext, however, doesn't support to access the feature map directly but only the individual (derived) features.