Commit f3d71771 authored by Matija Obreza's avatar Matija Obreza

FIX: mysql key limit, must trim collName

parent b6ddc4ed
......@@ -68,7 +68,7 @@ public class AccessionCollect extends BasicModel implements AccessionRelated, Se
@CollectionTable(name = "accession_collect_code", joinColumns = @JoinColumn(name = "collectId", referencedColumnName = "id"))
private Set<String> collCode;
@Column(name = "collName", nullable = false, length = 258)
@Column(name = "collName", nullable = false, length = 250)
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "accession_collect_name", joinColumns = @JoinColumn(name = "collectId", referencedColumnName = "id"))
private Set<String> collName;
......@@ -93,13 +93,13 @@ public class AccessionCollect extends BasicModel implements AccessionRelated, Se
// remove blank collCode
if (collCode != null && !collCode.isEmpty()) {
Set<String> notBlank = collCode.stream().filter(str -> StringUtils.isNotBlank(str)).collect(Collectors.toSet());
Set<String> notBlank = collCode.stream().map(str -> StringUtils.trimToNull(str)).filter(str -> str != null).collect(Collectors.toSet());
collCode.clear();
collCode.addAll(notBlank);
}
// remove blank collName
if (collName != null && !collName.isEmpty()) {
Set<String> notBlank = collName.stream().filter(str -> StringUtils.isNotBlank(str)).collect(Collectors.toSet());
Set<String> notBlank = collName.stream().map(str -> StringUtils.trimToNull(str)).filter(str -> str != null).map(str -> StringUtils.abbreviate(str, "...", 250)).collect(Collectors.toSet());
collName.clear();
collName.addAll(notBlank);
}
......
......@@ -1405,7 +1405,7 @@ databaseChangeLog:
constraints:
nullable: false
name: collName
type: VARCHAR(258)
type: VARCHAR(250)
tableName: accession_collect_name
- addPrimaryKey:
columnNames: collectId, collName
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment