DAO类无法投射

时间:2018-03-16 06:02:17

标签: java spring

我是CourseDetailsDAO和BeanDAO。我得到了

oneToRndRoot

这些行是:

CourseDetailsBean.java:49
 rndRoot :: Integral a => a -> a rndRoot = round . sqrt . fromIntegral oneToRndRoot :: Integral a => a -> [a] oneToRndRoot x = [1..rndRoot(x)] modulo :: (Ord p, Num p) => p -> p -> p modulo x y | n < 0 = x | otherwise = modulo n y where n = x - y mapMod :: (Num b, Ord b) => b -> [b] -> [b] mapMod x = map (modulo x) mapModToRndRoot :: Integral a => a -> [a] mapModToRndRoot n = mapMod n (oneToRndRoot n)

CourseDetailsBean.java:38
university.BeanDAO cannot be cast to university.CourseDetailsDAO at CourseDetailsBean.performLookup(CourseDetailsBean.java:49) at CourseDetailsBean.CoursedetailsAction(CourseDetailsBean.java:38)

BeanDAO

CourseDetailsDAO helper = (CourseDetailsDAO) apc.getBean("courseDetailsDao");

CourseDetailsDAO

performLookup(cID, cName, cDuration, cEligibility, cFee);

但我注意到服务器几乎没有警告,可能是失败的预测。

public List getStudent() {
List<Student> students = null;
    try
        {
            Session session = sessionFactory.openSession();
            org.hibernate.Transaction tx = session.beginTransaction();
            Query q = session.createQuery("from university.Student");
            students = (List<Student>)q.list();  

1 个答案:

答案 0 :(得分:0)

检查你的spring bean配置文件,你是否通过评估id是否正确将BeanDao和CourseDetailsDao声明为bean。你用它来获取对象引用。

CourseDetailsDAO helper = (CourseDetailsDAO) apc.getBean("courseDetailsDao");