Open m-kotzyba opened 3 years ago
Resaon: The templates
property of class Project
is declared as List<Template>
, however without a column indicating the sort order:
@ManyToMany(mappedBy = "projects", cascade = CascadeType.PERSIST)
private List<Template> templates;
This should be a Set<Template>
to avoid duplicates.
This is a general issue for all many-to-many relationships in our application: No duplicates are wanted, so Set<…>
should be used. (If order matters or duplicates are wanted to be allowed, List<…>
should be used with a column indicating the sorting, but our data model doesn’t have such a case.)
Only in Migration (System --> Migrieren --> Workflow erstellen --> Workflow anlegen):
If a new or an existing workflow is selected and than a new template (Neue Produktionsvorlage erstellen) is created, for the corresponding project, this new template is assigned twice to the project.
That is, the template it self is created correctly (only once in table kitodo.template) but listed twice in table kitodo.project_x_template. This can also be seen via the web interface: Projekte --> select the corresponding migrated project --> bearbeiten --> Productionsvorlagen.