<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma",sans-serif;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">We have recently worked through this problem on our 1.4.2 production server and our 1.5.1 test server.  It more than likely means that
 the parent child sequence does not exist in your sequence table.  <o:p></o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I’m sorry if my grammar is a little confusing (this was tough to figure out), but the following is what we experienced on our servers -
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">The error message is misleading.  The uniq_ao_position is a combined index of the parent_name and position fields.  The real issue lies with the sequence table. 
 The sequence for a specific parent child grouping or relationship <b>doesn’t exist
</b>or the <b>value</b> of the sequence is <b>less than</b> the number of child objects within that parent.  When a record is saved it checks against the sequence table.  If a sequence for a parent child grouping exists it checks the value of that sequence.
  If you have one child object the value would be 0 (because an index starts at 0) and if you have five child objects the value would be 4.  When saving a record where the sequence value is too low it will return an error similar to below with the current sequence
 value where you see 0 below.  To solve this issue, set your sequence value higher than the highest child position WITHIN your specific parent child grouping.  What was recommended to us to fix this issue was:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">“Recommend database backup. Develop query to (re)set appropriate sequence values (or just set all sequence values arbitrarily high -- WARN, TEST THIS and review
 related code!).”<o:p></o:p></span></p>
<div style="mso-element:para-border-div;border:solid #CCCCCC 1.0pt;padding:5.0pt 8.0pt 5.0pt 8.0pt;background:#F8F8F8">
<pre style="line-height:14.25pt;background:#F8F8F8;border:none;padding:0in;border-radius: 3px;max-width: 100%"><code><span style="font-family:Consolas;color:#2B2E2F;background:#F8F8F8">SELECT max(position) FROM archival_object;<o:p></o:p></span></code></pre>
<pre style="line-height:14.25pt;background:#F8F8F8;border:none;padding:0in"><code><span style="font-family:Consolas;color:#2B2E2F;background:#F8F8F8"># 416<o:p></o:p></span></code></pre>
<pre style="line-height:14.25pt;background:#F8F8F8;border:none;padding:0in"><code><span style="font-family:Consolas;color:#2B2E2F;background:#F8F8F8">UPDATE sequence SET value = 417;<o:p></o:p></span></code></pre>
<pre style="line-height:14.25pt;background:#F8F8F8;border:none;padding:0in"><code><span style="font-family:Consolas;color:#2B2E2F;background:#F8F8F8"># set all sequence values > than highest possible position to satisfy invariant<o:p></o:p></span></code></pre>
<pre style="line-height:14.25pt;background:#F8F8F8;border:none;padding:0in"><code><span style="font-family:Consolas;color:#2B2E2F;background:#F8F8F8"># not presently aware of a downside to this but BEWARE and TEST thoroughly<o:p></o:p></span></code></pre>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">The bigger issue is when the sequence for a parent child grouping doesn’t exist.  These are harder to find and we have been doing them on a case by case basis. 
 When you see the error message below and have done the above, there are a few ways to do this; Lyrasis highly recommends using the API (no idea how to do this), you can manually create the sequence in the SQL instance, OR the most common and straightforward
 way, which is to save the first child within a parent child grouping creating the sequence automatically.  In any of those instances the newly created sequence will have a value of 0, so if you have more than one child object already present you will need
 to update the sequence value for the parent child grouping to at least the number of present children objects.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I hope this helps. 
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Kyle Fortney<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Computer Specialist<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Library Systems<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">308 Edmon Low Library, OSU<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">(405) 744-7924<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> archivesspace_users_group-bounces@lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org]
<b>On Behalf Of </b>Fleming, Jason<br>
<b>Sent:</b> Tuesday, January 10, 2017 12:39 PM<br>
<b>To:</b> Archivesspace Users Group <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Subject:</b> [Archivesspace_Users_Group] Error message when saving record<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">We recently upgraded to 1.5.2 and we came across this error after saving a modification to the title of one of our archival objects<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#A94442;background:#F2DEDE">translation missing: en.no key - translation missing:
<a href="mailto:en.validation_errors.database_integrity_constraint_conflict__java__commysqljdbcexceptionsjdbc4__mysqlintegrityconstraintviolationexception__duplicate_entry__12276@archival_object-0__for_key__uniq_ao_pos_">
en.validation_errors.database_integrity_constraint_conflict__java__commysqljdbcexceptionsjdbc4__mysqlintegrityconstraintviolationexception__duplicate_entry__12276@archival_object-0__for_key__uniq_ao_pos_</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#A94442;background:#F2DEDE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I looked through the listserv and the closest thing I could find seemed to be a bug fixed several versions back in 2014<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Has anyone seen something similar or have any suggestions of where to look to fix this problem?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I have already tried rebooting the server but that didn’t change anything<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">-Jason</span>
<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>