0

I'm trying to do some basic application in AppFuse (multi-modular) and I'm stuck with this error. I have an DailyRecord entity, DailyRecordDao interface, DailyRecordDaoHibernate class, and DRManagerImpl class.

There are three methods in DailyRecordDao:

package com.diary.dao;

import java.sql.Date;
import java.util.List;

import org.appfuse.dao.GenericDao;

import com.diary.model.DailyRecord;

public interface DailyRecordDao extends GenericDao<DailyRecord, Long> {

    public List<DailyRecord> getDailyRecordsFrom(Date date, Long memberID);

    public DailyRecord getTodayDailyRecord(Long memberID);

    public DailyRecord getDailyRecord(Long memberID);
}

here is the DailyRecordDaoHibernate which implements this interface

package com.diary.dao;

import java.sql.Date;
import java.util.Calendar;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.appfuse.dao.hibernate.GenericDaoHibernate;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.diary.model.DailyRecord;

@Repository("dailyRecordDao")
public class DailyRecordDaoHibernate extends GenericDaoHibernate<DailyRecord, Long>
        implements DailyRecordDao {

    public DailyRecordDaoHibernate() {
        super(DailyRecord.class);
    }

    @Override
    public List<DailyRecord> getDailyRecordsFrom(Date date, Long memberID) {
        // TODO Auto-generated method stub
        return null;   //this isn't importat right now
    }

    @Override
    public DailyRecord getTodayDailyRecord(Long memberID) {

        return null;   //again not important, but this method works well when called in DRManagerImpl
    }

    @Override
    public DailyRecord getDailyRecord(Long memberID) {
        // TODO Auto-generated method stub
        return null;    //this method causes the problem
    }

}

And here is the manager:

package com.diary.service;

import java.sql.Date;
import java.util.List;

import org.appfuse.service.impl.GenericManagerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.diary.dao.DailyRecordDao;
import com.diary.model.DailyRecord;


@Service("drm")
public class DRManagerImpl extends GenericManagerImpl<DailyRecord, Long> implements
        DRManager {

    private DailyRecordDao drDao;

    @Autowired
    public DRManagerImpl(DailyRecordDao dailyRecordDao) {
        this.drDao = dailyRecordDao;
    }

    @Override
    public List<DailyRecord> getAll() {
        // TODO Auto-generated method stub
        return drDao.getAll();
    }

    @Override
    public List<DailyRecord> getDailyRecordsFrom(Date date, Long memberID) {
        // TODO Auto-generated method stub
        return drDao.getDailyRecordsFrom(date, memberID);
    }

    @Override
    public DailyRecord getTodayDailyRecord(Long memberID) {
        // TODO Auto-generated method stub
//      return drDao.getTodayDailyRecord(memberID);   this works
        return drDao.getDailyRecord(memberID);       //this will cause the error
    }

}

When I try to run the application with mvn jetty:run I get this error

[ERROR] COMPILATION ERROR :
[INFO] --------------------------------------
[ERROR] .../web/src/main/java/com/diary/service/DRManagerImpl.java[46,29] cannot find symbol
  symbol:    method getDailyRecord(java.lang.Long)
  location:  variable drDao of type com.diary.dao.DailyRecordDao

But if uncomment the getTodayDailyRecord() in manager and comment the getDailyRecord() method, everythig works. I think it has something to do with dependecies, but I'm really not sure since this is really confusing for me. I already tried mvn clean compile on web and core directories, deleting the target folders in those directories and then recompile it again but still, no luck. I will appreciate any help.

Cajova_Houba
  • 44
  • 1
  • 9

1 Answers1

0

Ok, so I managed to get it working. Without changing anything, I had written JUnit test which basicaly tests if dailyRecordDao.getDailyRecord() returns null. The test passed and everything went fine magically. I'm not sure whether I'm happy or just more confused.

Cajova_Houba
  • 44
  • 1
  • 9