Using sequences and sorting of the entities creation in one transaction

Using sequences and sorting of the entities creation in one transaction

Postby bmarotta » Wed 23 Sep 2015 10:54

Dear supporters,

We have an ID column which is automatically populated by a sequence as below:

Code: Select all
[Column(Name = @"ID", Storage = "_Id", AutoSync = AutoSync.OnInsert, CanBeNull = false, DbType = "NUMBER(9) NOT NULL", IsDbGenerated = true, IsPrimaryKey = true)]
        [Devart.Data.Linq.Mapping.SequenceGenerator(Sequence = "SEQ_PUMA_WORKFLOW_EXECUTION")]
        public int Id


We are creating many entries of this entity in a row. For us is very important that if Entity A was created before entity B, the ID of entity A is smaller than the ID of entity B. Apparently when creating many entities this is not the case and it can be that the last created entity doesn't have the last sequence value.

Could you please confirm if this is the case?

If yes, is there any alternative to ensure that the sequence numbers obey the order that the entities where created in the code?

Thanks in advance.
bmarotta
 
Posts: 34
Joined: Wed 29 Sep 2010 11:27

Re: Using sequences and sorting of the entities creation in one transaction

Postby MariiaI » Thu 24 Sep 2015 09:53

Could you please send us a small test project with the corresponding DDL scripts, so that we are able to reproduce this behaviour, investigate it and find the reasons/solutions for it in a shortest time.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for Oracle