ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Yee <r...@cruzio.com>
Subject Re: Problem with nullpointerException.
Date Sun, 22 Jul 2007 19:45:32 GMT
What line is it occurring on?
Did you initialize the DaoManager with the sqlMapConfig file?

This code:
dao.BeheerDAO beheerDao = (dao.BeheerDAO) 
DaoManagerRequester.getDaoManager().getDao(dao.BeheerDAO.class);

could be put somewhere else b/c it only has to run once. You could store 
the DAO in application scope.

-Richard

Davy wrote:
>
> Can someone explain me how I get the code mentioned below running?
>
> The problem is that it concerns a list and I don’t know correct how I 
> get it to work, the code that I developed gives me each time a 
> nullpointerexception when I run it.
>
> Can someone give me some information about what I do wrong?
>
> public RowBeheer[] readBeheerList1(String ondnr) {
>
> RowBeheer[] rowBeheer = null;
>
> try {
>
> dao.BeheerDAO beheerDao = (dao.BeheerDAO) 
> DaoManagerRequester.getDaoManager().getDao(dao.BeheerDAO.class);
>
> model.BeheerExample beheerExample = new model.BeheerExample();
>
> beheerExample.createCriteria().andReferentienummerLike(likesleutel);
>
> List resultList = beheerDao.selectByExample(beheerExample);
>
> if (resultList.size() > 0) {
>
> for(int i = 0; i < resultList.size(); i++) {
>
> rowBeheer[i] = new RowBeheer();
>
> model.Beheer beheer = (model.Beheer) resultList.get(i);
>
> rowBeheer[i].setReferentienummer(beheer.getReferentienummer());
>
> rowBeheer[i].setVolgnr(beheer.getVolgnr());
>
> rowBeheer[i].setRowdatumbegin(String.valueOf(beheer.getRowdatumbegin()));
>
> rowBeheer[i].setRowdatumeinde(String.valueOf(beheer.getRowdatumeinde()));
>
> rowBeheer[i].setKantoorcode(beheer.getKantoorcode());
>
> rowBeheer[i].setDossierstatus(beheer.getDossierstatus());
>
> return rowBeheer;
>
> }
>
> }
>
> } catch (Exception e) {
>
> e.printStackTrace();
>
> }
>
> return null;
>
> }
>


Mime
View raw message