use of com.tomasio.projects.trainning.dao.AreaDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method searchArea.
@Override
@Transactional(readOnly = true)
public AreaDTO[] searchArea(String term) {
AreaDAO dao = factory.getAreaDAO();
AreaDTO[] areasArray = null;
try {
List<Area> areas = dao.search(term);
if (areas != null) {
areasArray = new AreaDTO[areas.size()];
for (int i = 0; i < areas.size(); i++) {
areasArray[i] = areas.get(i).createDTO();
}
}
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return areasArray;
}
use of com.tomasio.projects.trainning.dao.AreaDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method createArea.
@Override
@Transactional
public Long createArea(AreaDTO dto) {
AreaDAO dao = factory.getAreaDAO();
Area _area = new Area(dto);
Long id = null;
try {
id = dao.create(_area);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return id;
}
Aggregations