yasuflatland-lf / damascus

⚔️ CRUD boilerplate generator for Liferay DXP
https://yasuflatland-lf.github.io/damascus-doc/
GNU Lesser General Public License v3.0
50 stars 35 forks source link

Damascus v.1.1.4 fails to create two or more records #93

Closed icarrara closed 4 years ago

icarrara commented 4 years ago

From the sample, there are the Employee model and Position model.

The below steps are valid for every entities (Employee, Position, DeepPosition).

Deploy the portlet and create a first record in Employee entity and leave empty the "Title" and "Summary" Damascus's auto-generated fields.

Then try to create a second record in Employee entity and leave empty the "Title" and "Summary" Damascus's auto-generated fields. - you get the duplicate error message: Duplicate entry '20124-0' for key 'IX_26F09727' because the 'urlTitle' field is everytime '0'.

The User needs to put something to avoid the error: Duplicate entry '20123-0' for key 'IX_A548BA27 - assuming there is one record already in place without content in "Title" and "Summary" Damascus's auto-generated fields.

The User needs to put something different from other records in those fields to avoid the error: Duplicate entry '20123-position-five' for key 'IX_A548BA27 - assuming there is one record already in place with "position-five" content in "Title" and "Summary" Damascus's auto-generated fields.

icarrara commented 4 years ago

base.json.txt

icarrara commented 4 years ago

Using Damascus V.1.13 the issue is still here.

89 doesn't solve the issue.

The issue affect every level of relationship between entities, for example Employee, Position, DeepPosition (an eventual third level of relatinship - the parent entity is Position).

In every entity, in "Edit" screen Damascus creates two fields: immagine

The User needs to put something to avoid the error: Duplicate entry '20123-0' for key 'IX_A548BA27' - assuming there is one record already in place without content in "Title" and "Summary" Damascus's auto-generated fields.

The User needs to put something different from other records in those fields to avoid the error: Duplicate entry '20123-position-five' for key 'IX_A548BA27' - assuming there is one record already in place with "position-five" content in "Title" and "Summary" Damascus's auto-generated fields.

icarrara commented 4 years ago

Using damascus.build.number=V1.1.4TS20191213045547.

Steps to reproduce:

  1. Insert a record without to fill the "Title" and "Summary" Damascus's auto-generated fields.

  2. In databse you can see the below: immagine

  3. Insert a new record without to fill the "Title" and "Summary" Damascus's auto-generated fields.

  4. You get the error: Duplicate entry '20123-0' for key 'IX_7C719B8F'

  5. Edit and update the first record without to fill the "Title" and "Summary" Damascus's auto-generated fields.

  6. In databse you can see the below: immagine Damascus's logic copied the ID of the record in the "urlTitle" field so never Duplicate entry .... error happens.

The issue is confirmed when you insert a new record leaving empty the "Title" and "Summary" Damascus's auto-generated fields or putting in it values already presents in the table.

icarrara commented 4 years ago

Ok, fixed.

Tested with Liferay 7.2.0 and 7.2.1.