如何将JPQL查询结果导入java类

时间:2014-06-25 05:36:35

标签: java-ee

我正确运行DOA

@Stateless

@LocalBean 公共类WebServiceMethodDao扩展了BaseDao {

public WebServiceMethodDao() {
    super(WebServiceMethod.class);
}

public WsInfo getWebServiceByMethod(Long webMethodId) {
    System.out.println("getEntityManager() " + getEntityManager());
    WsInfo wsInfo = getEntityManager().
            createQuery("SELECT NEW mn.interactive.module.ws.dto.WsInfo( ws.wsdlUrl , ws.wsNamespace , ws.wsLocalPart , wsm.description) FROM WebService ws join ws.metaServiceMethods wsm  WHERE wsm.methodId = :methodId", WsInfo.class)
            .setParameter("methodId", webMethodId)
            .getSingleResult();
    return wsInfo;
}  

}

然后我需要将“getWebServiceByMethod”查询结果导入java类。

public class WsFunction extends Function {



@EJB
private WebServiceMethodDao dao;


public WsFunction() {        
}


public WsInfo getWsInfo(String webMethodId) throws ServiceFault {
    WsInfo wsi = dao.getWebServiceByMethod(Long.valueOf(webMethodId));
    return wsi;
}

}

但是在这种情况下“dao”为null如何将JPQL查询的结果导入java类

0 个答案:

没有答案