This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Normal 0 false false false EN-AU X-NONE X-NONE MicrosoftInternetExplorer4 <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p {mso-style-noshow:yes; mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman";} span.EmailStyle15 {mso-style-type:personal; mso-style-noshow:yes; mso-style-unhide:no; mso-ansi-font-size:11.0pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} Hi Guys, I'm using multisequences on an oracle database, and intermittently I’m getting an oracle error saying that the sequence is violating the PK constraint. I think the error is because how I'm building my objects. I'm building up an object which contains lists of 2 other object types each mapping to a DB table (3 tables). This could be a big set objects. Then I'm saving the main object which will inturn save all the children objects. I think the problem is concurrency, what happens process 1 kicks off and instantiates an object based upon a table, then process 2 writes to the tables for what ever reason, finally process 1 try to save persist the object and gets the PK violation error. So I guess the question is, does the sequence get called when I instantiate the object or when i persist it to the database. Thanks Again for your help, You guys have helped me out of quite a few jams. Josh |
|
|
Sorry about the office formatting. |
|
|
Hi Josh, Sorry for the delay in replying -- holidays... The sequence gets called when the entity is added to the unit of work. This can be explicit (by calling IUnitOfWork.Add(entity)) or implicit (e.g. added to an EntityCollection belonging to something that is in the UOW, setting an association to something that's in the UOW). However, values are allocated from the sequence in a block and this is done transactionally, so there shouldn't be any race conditions around this. What may be happening is that your IdentityBlockSize is out of sync with your sequence INCREMENT BY. When using sequences, the IdentityBlockSize MUST be the INCREMENT BY amount of the sequence; otherwise LightSpeed can't correctly calculate the block start. http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=1988&PostID=7739 discusses this in more detail. |
|
|
Hi Ivan,
Thanks Again, Josh |
|
|
Explicitly setting the block size should resolve the issue. If the identity block size is the same as the INCREMENT BY size, then when LightSpeed initially queries the sequence, the sequence will be advanced by the INCREMENT BY amount, and LightSpeed will then count back by the identity block size, so all will be well. I believe this should be okay even if non-LightSpeed applications are sharing the same sequence as LightSpeed, but we have not tested this scenario, so if this is your scenario, I'd advise doing a quick test on this before embarking on a full load test. |
|