public Llfc getLlfc(String code) throws HttpException {
Integer llfcInt = null;
try {
llfcInt = Integer.parseInt(code);
} catch (NumberFormatException e) {
throw new UserException(
"The LLFC must be an integer between 0 and 999.");
}
Llfc llfc = (Llfc) Hiber.session().createQuery(
"from Llfc llfc where llfc.dno = :dno and llfc.code = :code")
.setEntity("dno", this).setInteger("code", llfcInt)
.uniqueResult();
if (llfc == null) {
throw new UserException("There is no LLFC with the code " + code
+ " associated with the DNO " + getCode() + ".");
}
return llfc;
}