I'm leveraging the interoperability between Scala and Java and have the below code that uses Scala, to instantiate a class in the same project that was written in Java. The CommandExecutor parameter is inherited from a parent class.
class IdmIdentityServiceImpl extends ServiceImpl with IdmIdentityService {
override def createNativeUserQuery: NativeUserQuery = {
new NativeUserQueryImpl(commandExecutor)
}
}
I get an error, in instantiating NativeUserQueryImpl that says cannot resolve constructor
NativeUserQueryImpl was written in Java, but I've been reading about the interoperability between Java and Scala and feel like it should work.
This is the NativeUserQueryImpl class, which takes in that CommandExecutor type in one of it's constructors. The class comes from the flowable-engine library.
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:
Full error
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)
commandExecutordefined?ServiceImplcannot resolve constructor