从dao获取空指针异常

时间:2016-10-01 07:40:33

标签: java spring hibernate

我在调用方法时收到NullPointerException: Xgenexport.java

Map agent_Details = commonLookupDAO.getAgentDetails(dQuoteDetails.getAgentId());

方法如下: Commonlookup dao:

public Map getAgentDetails(String agentId);

Commonlookupdaoimpl

public Map getAgentDetails(String agentId) {
    /*some code*/
    return resultMap;
}

我在调用此方法时得到NullPointerException并不知道具体原因。

1 个答案:

答案 0 :(得分:0)

如何创建对象use std::rc::Rc; #[derive(Clone)] pub struct MyStructRef<'f> { field: usize, mapper: &'f Fn(usize) -> f64, } #[derive(Clone)] pub struct MyStructRc { field: usize, mapper: Rc<Fn(usize) -> f64>, } fn main() { //ref let closure = |x| x as f64; let f = MyStructRef { field: 34, mapper: &closure }; let g = f.clone(); println!("{}", (f.mapper)(3)); println!("{}", (g.mapper)(3)); //Rc let rcf = MyStructRc { field: 34, mapper: Rc::new(|x| x as f64 * 2.0) }; let rcg = rcf.clone(); println!("{}", (rcf.mapper)(3)); println!("{}", (rcg.mapper)(3)); }

使用commonLookupDAO如果您要创建Spring <{1}} Autowire对象,则可能需要使用Single