I have tried to read data from Oracle database using mybatis.
I have written below query in db.xml :
<select id="selectItemPartNumberWithEco" resultType="String">
SELECT ITEM_PART_NUMBER from CIS_ITEM_AGILE_ECO_DATA_TBL WHERE ECO_NUMBER IS NOT NULL
</select>
<select id="selectItemPartNumberWithoutEco" resultType="String">
SELECT ITEM_PART_NUMBER from CIS_ITEM_AGILE_ECO_DATA_TBL WHERE ECO_NUMBER IS NULL
</select>
my db.java(interface) file has following declaration :
public List<String> selectItemPartNumberWithEco() throws DAOException;
public List<String> selectItemPartNumberWithoutEco() throws DAOException;
My implementation class has following code :
public List<String> selectItemPartNumberWithEco() throws DAOException {
return repoItemDAO.selectItemPartNumberWithEco();
}
public List<String> selectItemPartNumberWithoutEco() throws DAOException {
return repoItemDAO.selectItemPartNumberWithoutEco();
}
I have called the above class as follows :
RepoServiceImpl repoServiceObj = new RepoServiceImpl();
List<String> existingDbAgileItemList = repoServiceObj.selectItemPartNumberWithEco();
List<String> newDbAgileItemList = repoServiceObj.selectItemPartNumberWithoutEco();
While executing my code i am getting null pointer exception.
How to select a column from DB using mybatis?