This article is a legacy article. It applies to previous versions of the Liferay product. While the article is no longer maintained, the information may still be applicable.
Upon updating a document to the 10th version, you may see an error similar to this:
ERROR [JDBCExceptionReporter:101] ORA-00001: unique constraint (LIFERAYTEST.IX_2F8FED9C) violated
When the file version is calculated, the last entry is read from the database table dlfileversion. FileVersionVersionComparator appends the following to the end of the SQL: order by version DESC.
As the field version is a "string" the latest version is not always picked up. For example version 1.10 is lower than 1.2 if we compare them asstring values.
When the version 1.10 is uploaded the following happens:
- Last db version is 1.9 so the new calculated value will be 1.10
- DLFileVersion 1.10 is saved into the database
- The last DLFileVersion is read from the database which, according to the comparator, is 1.9 (not 1.10)
- The DlFileEntry is updated with the version 1.9
- Next time we want to upload a file there will be a duplicate constraint exception it wants to save a new DLFileVersion entry with version 1.10.
To resolve this issue, please open a Help Center ticket requesting the solution from LPS-13835.