[FIX] many-many support every key type

This commit is contained in:
Edouard DUPIN 2025-01-25 12:14:50 +01:00
parent 990b7c08da
commit 9dad14d200

View File

@ -355,12 +355,12 @@ public class AddOnManyToMany implements DataAccessAddOn {
final FieldName columnName = AnnotationTools.getFieldName(field, options); final FieldName columnName = AnnotationTools.getFieldName(field, options);
final String linkTableName = generateLinkTableName(tableName, columnName.inTable()); final String linkTableName = generateLinkTableName(tableName, columnName.inTable());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final List<Long> dataCasted = (List<Long>) data; final List<Object> dataCasted = (List<Object>) data;
if (dataCasted.size() == 0) { if (dataCasted.size() == 0) {
return; return;
} }
final List<LinkTableGeneric> insertElements = new ArrayList<>(); final List<LinkTableGeneric> insertElements = new ArrayList<>();
for (final Long remoteKey : dataCasted) { for (final Object remoteKey : dataCasted) {
if (remoteKey == null) { if (remoteKey == null) {
throw new DataAccessException("Try to insert remote key with null value"); throw new DataAccessException("Try to insert remote key with null value");
} }