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

Bug 351185

Summary: Derived containment references that uses feature maps can't be saved to store
Product: [Modeling] EMF Reporter: Nikolay Kasyanov <corrmage>
Component: cdo.coreAssignee: Project Inbox <emf.cdo-inbox>
Status: CLOSED WONTFIX QA Contact: Eike Stepper <stepper>
Severity: major    
Priority: P3 CC: akafakir
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
eclipse project with generated test model
none
used cdo server config
none
stacktrace
none
unit test
none
client patch
none
server stacktrace
none
right patch, against svn branch '4.0-maintanence'
none
patch
none
stack trace for new issue none

Description Nikolay Kasyanov CLA 2011-07-05 09:14:56 EDT
Build Identifier: I20110613-1736

If model has reference that uses feature map and this reference is derived (and
transient, volatile), model instances with elements in such references can not be saved to store due to exception.

Tested with db (mysql) & db4o store backends.

Reproducible: Always

Steps to Reproduce:
1. Launch CDO server.
2. From CDO ui open session, add generated package http://agentlab.ru/cdo/tests to registry.
3. Start transaction.
4. Create new resource.
5. Add Library element to resource from package http://agentlab.ru/cdo/tests.
6. Add Writer element to previously created Library element.
7. Try to save resource.
Comment 1 Nikolay Kasyanov CLA 2011-07-05 09:16:06 EDT
Created attachment 199118 [details]
eclipse project with generated test model
Comment 2 Nikolay Kasyanov CLA 2011-07-05 09:17:28 EDT
Created attachment 199119 [details]
used cdo server config
Comment 3 Nikolay Kasyanov CLA 2011-07-05 09:23:12 EDT
Created attachment 199120 [details]
stacktrace
Comment 4 Nikolay Kasyanov CLA 2011-07-13 17:41:11 EDT
Created attachment 199621 [details]
unit test

I screwed up in "steps to reproduce", you need to commit transaction after adding Library instance and only then add child items.
Wrote unit test for generated and dynamic case. To use generated model use previously attached project.
Comment 5 Nikolay Kasyanov CLA 2011-07-13 17:42:22 EDT
I mean testcase, not unit test, of cource.
Comment 6 Nikolay Kasyanov CLA 2011-07-15 13:49:51 EDT
Created attachment 199763 [details]
client patch

Made some fix, that possibly fixes problem on client, but raises new problem on server.
I'll attach stacktrace.
Comment 7 Nikolay Kasyanov CLA 2011-07-15 13:58:42 EDT
Created attachment 199764 [details]
server stacktrace

To get this stacktrace simply apply change from patch and do "steps to reproduce".

looks like visitor's id not updated in library's delta.
Comment 8 Nikolay Kasyanov CLA 2011-07-15 14:25:13 EDT
Created attachment 199767 [details]
right patch, against svn branch '4.0-maintanence'
Comment 9 Nikolay Kasyanov CLA 2011-07-22 11:18:12 EDT
Created attachment 200208 [details]
patch

extended patch to fix server problem.
Can somebody review it?
Looks like it reveals another problem, I'll attach stack trace.
Comment 10 Nikolay Kasyanov CLA 2011-07-22 11:25:30 EDT
Created attachment 200209 [details]
stack trace for new issue

After applying provided patch one can add Writers and Visitors to already stored Library (in terms of provided score model). After saving Library with newly added Writers and Visitors try to add more. You'll get following stack trace.

Another glitch: "delete" menu item is inactive for writers and visitors and when trying to delete library with children I got "legacy mode is not enabled" exception, though I'm using native model.
Comment 11 Eike Stepper CLA 2012-08-14 22:55:50 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 12 Eike Stepper CLA 2013-06-29 12:17:08 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 13 Leonid Ripeynih CLA 2013-10-30 09:54:23 EDT
Eike, 
i've run into that problem today, with my .ecore model initially generated from XSD. 

Do you have any plans to adress it in near feature?
Comment 14 Eike Stepper CLA 2015-07-14 02:18:29 EDT
Moving all open bugzillas to 4.5.
Comment 15 Eike Stepper CLA 2016-07-31 01:01:21 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 16 Eike Stepper CLA 2016-09-24 01:40:55 EDT
We have no plans to support feature maps.