Deleting versioned class
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


12»»

Deleting versioned class Expand / Collapse
Author
Message
Posted 2010-04-26 19:30:34
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-08-12 11:54:38
Posts: 85, Visits: 401
Hi,

I have a 1..n association between two classes, both are versioned. I want to remove one item from the list and delete it. I do the following:
item.AsIObject().Delete();

The object dissappears in the list and I save the ecospace. After restaring the program, it is in the list again.

Am I doing something wrong?

Thank you,
Johannes
Post #5168
Posted 2010-04-26 21:28:45
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Yesterday @ 22:44:38
Posts: 144, Visits: 679
Hi Johannes,

deleting a versioned object is done by setting the value TIMESTAPTSTOP in table ECOMODELROOT.
Please check if this value is set for the deleted object (seach for ECOID).
Maybe check which SQL is generated by deleting the object.

Post #5169
Posted 2010-04-27 13:24:36
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-08-12 11:54:38
Posts: 85, Visits: 401
Hi,

the TIMESTAMPSTOP is set, but the dataset is not deleted, which I suppose should not be deleted anyhow.

What is wrong?

Thanks,
Johannes

Post #5172
Posted 2010-04-28 01:16:48
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Yesterday @ 22:44:38
Posts: 144, Visits: 679
This could have several reasons (we are using versioning since years and never had problems, so what I'm now wrinting is hypothetical):

* Is TIMESTAMPSTOP set to a value less than MAXINT? I would assume this now.
* The class must be set to be versioned in the model.
* ECO shouldn't see your deleted objects as it creates SQLs that only show objects that have a TIMESTAMPSTOP with value MAXINT in table ECOMODELROOT. So please check the generated SQL (maybe with debugger).
* Please post this SQL. I think we can find the error when we have the SQL.

Post #5173
Posted 2010-04-29 14:52:15
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-08-12 11:54:38
Posts: 85, Visits: 401
Hi Peter,

 

I had a close look and it looks like a wrong SQL-phrase.

The TIMESTAMPSTOP ist set to 2147483647 (MAXINT) before deleting, and 14 (or a different value, depending on the state of th DB of course) after deleting the object and the class is set to versioned in the model (I switched UseClockLog,UseTimestampColoumn and usetimestamptable to true in the p-mapper)

 

I had SQL profiler running while loading the data and the sql which is used to get the list is this one:

exec sp_executesql N'
SELECT Rezeptur_A.ECO_ID, Rezeptur_A.ECO_TYPE, Rezeptur_A.ProduktionsDaten, Rezeptur_A.LastModifiedTime, Rezeptur_A.CreatedTime, Rezeptur_A.CreatedBy, Rezeptur_A.LastModifiedBy, Rezeptur_A.Edukt, Rezeptur_A.EduktName

FROM Rezeptur Rezeptur_A

WHERE Rezeptur_A.ProduktionsDaten = @ID0',N'@ID0 uniqueidentifier',@ID0='B8BA38E3-51F3-4E94-A197-5E835EFF43F3'

The ID0 is the correct ID for the single object which has multiple Rezeptur classes (sorry that the data is in german)

It seems that ECO is not adding the TIMESTAMPSTOP<>MAXINT to the SQL-query. How can I do this?

Thanks,
Johannes

Post #5175
Posted 2010-04-30 01:21:34
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Yesterday @ 22:44:38
Posts: 144, Visits: 679
Hi Johannes,

are you using OCL or OCLPS for querying the data? Please recognize that only OCL ist working correctly for versioned classes.
You cannot use OCLPS for versioned classes as it shows such errors.

And now in our boths mother language:

Ich habe dazu vor Jahren einen Mantis-Fehler (#480) eröffnet, der immer noch nicht gelöst wurde. (I opened a mantis bug #480 years ago for this issue which is not solved for now).

Post #5177
Posted 2010-04-30 08:55:16
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-08-12 11:54:38
Posts: 85, Visits: 401
Hi Peter,

I am using an expression handle, which I assume is using OCL and not OCLPS???

The OCL-Query is self.produktionsDaten.Rezeptur which returns a list of Rezeptur.

Maybe we should reopen a new Mantis for it?

Thanks, (Dankeschön!!)
Johannes

Post #5180
Posted 2010-04-30 16:39:13
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-08-12 11:54:38
Posts: 85, Visits: 401
Hi,

I created a testproject which shows the same error.

Running expressionhandle versus OCLPSHandle results in different results:
expresisonhandle returns the amount of objects (incl the deleted ones) so for example 3 (2 "excisting" and 1 deleted)
OCLPS returns for example 5 (incl. older "versioned" objects..)

What can I do? This way, it is hard to use Eco with versioning...

Thanks,
Johannes
Post #5182
Posted 2010-05-01 00:20:40
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Yesterday @ 22:44:38
Posts: 144, Visits: 679
Johannes,

first of all, we are using versioning with ECO3 and there are a lot people that are also using versioning. Deleting objects works for us and so I think that there is no basic problem within ECO.

So we have to find out, what's going wrong for you. I am wondering about following:

1) Versioning usually needs a TIMESTAMPSTART column in the table which corresponds with the value of the column TIMESTAMPSTART in table ECOMODELROOT.
2) The created SQL needs a join with ECOMODELROOT to get the current objects. Join columns have to be ECOID and TIMESTAMPSTART, in the where clause TIMESTAMPSTOP is compared to MAXINT. Please try following: Find out which SQL is generated for your OCL statement "CL_Rezeptur.AllInstances" and post this SQL here. Your SQL is loading a specific object. While doing AllInstances you should only get the IDs of the objects.
3) There must be a wrong setting somewhere in your configuration but with your current error description I cannot imagine where the error is. Have you switched on versioning in Modlr for this specific class (value of attribute "versioned" must be set to true)?
4) Have you got inheritance in you model?

Post #5184
Posted 2010-05-01 14:21:20
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-08-12 11:54:38
Posts: 85, Visits: 401
Hi Peter,

I have created a small project which shows two errors (Assertion error, different thread and the deleting objects problem) It is attached to the thread here. In here I have an Order...Item association (1..n) and I cannot delete items. After restarting the app they appear again. I think the TIMESTAMPSTOP values are all set correctly (from MAXINT to the corresponding TIMESTAMPSTART-value in the items table). The SQL which is created for Items.Allinstances (would correspond to Rezeptur.allinstances) looks the following:
SELECT ECOModelRoot_A.ECO_ID, ECOModelRoot_A.ECO_TYPE FROM ECOModelRoot ECOModelRoot_A INNER JOIN Item Item_A ON ECOModelRoot_A.ECO_ID = Item_A.ECO_ID AND ECOModelRoot_A.TIMESTAMPSTART = Item_A.TIMESTAMPSTART  


The expressionhandle returns all objects (incl the deleted ones) and looking at the SQL I see that there is no comparison with TIMESTAMPSTOP. It will get the latest result, also when its TIMESTAMPSTOP value is set.

If I have an error in the project, I do not know at the moment where it is

I also have inheritance in the main-project, not in the attached testproject.

Thanks,
Johannes


  Post Attachments 
EcoProject1.zip (6 views, 238,29 KB)
Post #5185
« Prev Topic | Next Topic »

12»»

Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 9:58

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,344. 11 queries. Compression Disabled.