Getting a NullPointerException on line in BOLD/RED...any help is greatly appreciated!!! Note: I commented out my query in PosJpaDaoImpl, just
to eliminate any possible additional problems....
PlyHandler.java :
Declaration:
private PosService posService;
Code:
ArrayList<
String> posList = new ArrayList<String>(Arrays.asList(" "," ", " ", " ", " "));
try {
posList = posService.getAllPos();
//@SuppressWarnings("unchecked")
//System.out.println("posList: " + posList);
}
catch (NullPointerException e) {
e.printStackTrace();
}
PosService.java
public interface PosService {
public PosModel savePos(PosModel pos);
public PosModel getPos(String posID);
public void delPos(String posID);
public ArrayList getAllPos();
}
PosJpaServiceImpl.java:
//******************************************************************
// getAllPos *
//******************************************************************
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public ArrayList getAllPos(){
return posDao.getAllPos();
}
PosDao.java:
//******************************************************************
// PosDao Interface *
//******************************************************************
public interface PosDao {
public PosModel getPos(String posID);
public PosModel savePos(PosModel pos);
public void removePos(String posID);
public ArrayList getAllPos();
}
PosJpaDaoImpl:
//******************************************************************
// getAllPos *
//******************************************************************
public ArrayList getAllPos() {
//List posList;
ArrayList<String> posList = new ArrayList<String>(Arrays.asList(" "," ", " ", " ", " "));
posList.add("QB");
posList.add("RB");
posList.add("WR");
System.out.println("Before Executing getAllPos");
/* try {
Query query = entityManager.createNamedQuery("getAllPos");
posList = query.getResultList();
} catch (RuntimeException runtimeException) {
System.out.println("Error XXXXX getResultList");
throw new PosDatabaseException("EntityManager exception", runtimeException);
}*/
//return (ArrayList)posList;
return posList;
}