Я использую интероперабельность между Scala и Java и имею следующий код, который использует Scala, для создания экземпляра класса в том же проекте, который был написан на Java. Параметр CommandExecutor
наследуется от родительского класса.Scala не может разрешить конструктор
class IdmIdentityServiceImpl extends ServiceImpl with IdmIdentityService {
override def createNativeUserQuery: NativeUserQuery = {
new NativeUserQueryImpl(commandExecutor)
}
}
Я получаю сообщение об ошибке, в инстанцировании NativeUserQueryImpl
, что говорит cannot resolve constructor
NativeUserQueryImpl
был написан на Java, но я читал о совместимости между Java и Scala и чувствовать себя, как он должен работать.
Это класс NativeUserQueryImpl
, который принимает тип CommandExecutor
в одном из его конструкторов. Класс поставляется из библиотеки с текущими двигателями.
public class NativeUserQueryImpl extends AbstractNativeQuery<NativeUserQuery, User> implements NativeUserQuery {
private static final long serialVersionUID = 1L;
public NativeUserQueryImpl(CommandContext commandContext) {
super(commandContext);
}
public NativeUserQueryImpl(CommandExecutor commandExecutor) {
super(commandExecutor);
}
// results ////////////////////////////////////////////////////////////////
public List<User> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) {
return commandContext.getUserEntityManager().findUsersByNativeQuery(parameterMap, firstResult, maxResults);
}
public long executeCount(CommandContext commandContext, Map<String, Object> parameterMap) {
return commandContext.getUserEntityManager().findUserCountByNativeQuery(parameterMap);
}
}
EDIT:
Полная ошибка
Error:(31, 5) overloaded method constructor NativeUserQueryImpl with alternatives:
(x$1: org.flowable.idm.engine.impl.interceptor.CommandExecutor)org.flowable.idm.engine.impl.NativeUserQueryImpl <and>
(x$1: org.flowable.idm.engine.impl.interceptor.CommandContext)org.flowable.idm.engine.impl.NativeUserQueryImpl
cannot be applied to (org.flowable.engine.impl.interceptor.CommandExecutor)
new NativeUserQueryImpl(commandExecutor)
Где определяется 'commandExecutor'? – nmat
@nmat в том же проекте – Rafa
Наследуется от родительского класса. Я добавляю полную подпись класса, в которой это содержится. Он находится в 'ServiceImpl' – Rafa