添加新方法时我丢失了一些东西,但我不知道是什么?它在userDAO.countUsers行中生成找不到符号的编译错误:

@Autowired
private UserDAO userDAO;

    @Async
private Future<Long> searchCount(MultiValueMap<String, String> parameters) throws DaoException {


   userDAO.countUsers("bla bla");


    return new AsyncResult<Long>(Long.getLong("1")); // temp code
}


这是服务接口:

public interface UserDAO {

long countUsers(String bloblo) throws DaoException;


这是实现:

    @Service("userDAO")
    @SuppressWarnings("unchecked")
    @Transactional(readOnly = true, timeout = Constants.TRANSACTION_TIMEOUT, propagation = Propagation.SUPPORTS)
    public class UserDaoImpl implements UserDAO {

@PersistenceContext
private EntityManager em;

   @Override
    public long countUsers(String bloblo) throws DaoException {
        // Build request
        final QueryCriteria qc = new QueryCriteria(bloblo);

        final StringBuilder request = prepareQuery(qc);
        request.replace(7, 21, "count(distinct user)");
        final Query query = em.createQuery(request.toString());

        // Build parameters
        addParameters(query, qc);

        // Execute
        try {
            return (Long) query.getSingleResult();
        } catch (final RuntimeException e) {
            LOG.error(e.getMessage(), e);
            throw new DaoException(e);
        }
    }


帮助真的很感激!

最佳答案

确保您确实从userDAO.countUsers()调用(LanguageCode,UserType,UserRightOrder)导入了类。
也许您应该粘贴错误消息?

关于java - 在基本服务上找不到符号,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35986264/

10-10 05:59