Compare commits
No commits in common. "8f3c14e28d1b8fc051aa65a7a8a41835f48acfe0" and "990b7c08daaa14b8e4705c95c0565ccacb4dce92" have entirely different histories.
8f3c14e28d
...
990b7c08da
@ -815,9 +815,6 @@ public class DBAccessSQL extends DBAccess {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING")
|
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING")
|
||||||
public <T> T insert(final T data, final QueryOption... option) throws Exception {
|
public <T> T insert(final T data, final QueryOption... option) throws Exception {
|
||||||
if (data == null) {
|
|
||||||
throw new DataAccessException("Try to check a null data ==> wrong API");
|
|
||||||
}
|
|
||||||
final Class<?> clazz = data.getClass();
|
final Class<?> clazz = data.getClass();
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
|
|
||||||
|
@ -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<Object> dataCasted = (List<Object>) data;
|
final List<Long> dataCasted = (List<Long>) 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 Object remoteKey : dataCasted) {
|
for (final Long 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");
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import java.sql.Timestamp;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -476,7 +475,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
if (dataJson != null && dataJson.checker() != null) {
|
if (dataJson != null && dataJson.checker() != null) {
|
||||||
final CheckFunctionInterface checkerInstance = dataJson.checker().getDeclaredConstructor()
|
final CheckFunctionInterface checkerInstance = dataJson.checker().getDeclaredConstructor()
|
||||||
.newInstance();
|
.newInstance();
|
||||||
// check if the type is a list, set, ...
|
|
||||||
add(fieldName,
|
add(fieldName,
|
||||||
(
|
(
|
||||||
final DBAccess ioDb,
|
final DBAccess ioDb,
|
||||||
@ -486,24 +484,7 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
final QueryOptions options) -> {
|
final QueryOptions options) -> {
|
||||||
// get the field of the specific element
|
// get the field of the specific element
|
||||||
final Object tmpData = field.get(data);
|
final Object tmpData = field.get(data);
|
||||||
// It is not the objective of this element to check if it is authorize to set NULL
|
checkerInstance.check(ioDb, baseName, tmpData, null, options);
|
||||||
if (tmpData == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (tmpData instanceof Collection) {
|
|
||||||
final Collection<?> tmpCollection = (Collection<?>) tmpData;
|
|
||||||
final Object[] elements = tmpCollection.toArray();
|
|
||||||
for (int iii = 0; iii < elements.length; iii++) {
|
|
||||||
if (elements[iii] != null) {
|
|
||||||
checkerInstance.check(ioDb, baseName + '.' + fieldName + '[' + iii + ']',
|
|
||||||
elements[iii], null, options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
checkerInstance.check(ioDb, baseName + '.' + fieldName, tmpData, null, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// keep this is last ==> take more time...
|
// keep this is last ==> take more time...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user