Commit f3d71771 authored by Matija Obreza's avatar Matija Obreza
Browse files

FIX: mysql key limit, must trim collName

parent b6ddc4ed
...@@ -68,7 +68,7 @@ public class AccessionCollect extends BasicModel implements AccessionRelated, Se ...@@ -68,7 +68,7 @@ public class AccessionCollect extends BasicModel implements AccessionRelated, Se
@CollectionTable(name = "accession_collect_code", joinColumns = @JoinColumn(name = "collectId", referencedColumnName = "id")) @CollectionTable(name = "accession_collect_code", joinColumns = @JoinColumn(name = "collectId", referencedColumnName = "id"))
private Set<String> collCode; private Set<String> collCode;
@Column(name = "collName", nullable = false, length = 258) @Column(name = "collName", nullable = false, length = 250)
@ElementCollection(fetch = FetchType.LAZY) @ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "accession_collect_name", joinColumns = @JoinColumn(name = "collectId", referencedColumnName = "id")) @CollectionTable(name = "accession_collect_name", joinColumns = @JoinColumn(name = "collectId", referencedColumnName = "id"))
private Set<String> collName; private Set<String> collName;
...@@ -93,13 +93,13 @@ public class AccessionCollect extends BasicModel implements AccessionRelated, Se ...@@ -93,13 +93,13 @@ public class AccessionCollect extends BasicModel implements AccessionRelated, Se
// remove blank collCode // remove blank collCode
if (collCode != null && !collCode.isEmpty()) { 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.clear();
collCode.addAll(notBlank); collCode.addAll(notBlank);
} }
// remove blank collName // remove blank collName
if (collName != null && !collName.isEmpty()) { 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.clear();
collName.addAll(notBlank); collName.addAll(notBlank);
} }
......
...@@ -1405,7 +1405,7 @@ databaseChangeLog: ...@@ -1405,7 +1405,7 @@ databaseChangeLog:
constraints: constraints:
nullable: false nullable: false
name: collName name: collName
type: VARCHAR(258) type: VARCHAR(250)
tableName: accession_collect_name tableName: accession_collect_name
- addPrimaryKey: - addPrimaryKey:
columnNames: collectId, collName 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