@Test public void testGetByUnexistantCode() { System.out.print("test Language getByCode with unexistant code"); String code = "dd"; Language result = lDao.getByCode(code); Assert.assertNull(result); }
public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restrictions.eq("code", code)).uniqueResult(); logger.debug(lang); return lang; } catch (NonUniqueResultException ne) { logger.error("getByCode returned more than one object", ne); return null; } catch (HibernateException he) { logger.error("Persistence or jdbc Exception in Method getByCode", he); return null; } catch (Exception e) { logger.error("Exception in getByCode", e); return null; } }
LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restrictions.eq("code", code)).uniqueResult(); logger.debug(lang); return lang; } catch (NonUniqueResultException ne) { logger.error("getByCode returned more than one object", ne); return null; } catch (HibernateException he) { logger.error("Persistence or jdbc Exception in Method getByCode", he); return null; } catch (Exception e) { logger.error("Exception in getByCode", e); return null; } } }
LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restrictions.eq("code", code)).uniqueResult(); logger.debug(lang); return lang; } catch (NonUniqueResultException ne) { logger.error("getByCode returned more than one object", ne); return null; } catch (HibernateException he) { logger.error("Persistence or jdbc Exception in Method getByCode", he); return null; } catch (Exception e) { logger.error("Exception in getByCode", e); return null; } } LanguageDAOImpl(); }
LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restrictions.eq("code", code)).uniqueResult(); logger.debug(lang); return lang; } catch (NonUniqueResultException ne) { logger.error("getByCode returned more than one object", ne); return null; } catch (HibernateException he) { logger.error("Persistence or jdbc Exception in Method getByCode", he); return null; } catch (Exception e) { logger.error("Exception in getByCode", e); return null; } } LanguageDAOImpl(); Language getByCode(String code); }
LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restrictions.eq("code", code)).uniqueResult(); logger.debug(lang); return lang; } catch (NonUniqueResultException ne) { logger.error("getByCode returned more than one object", ne); return null; } catch (HibernateException he) { logger.error("Persistence or jdbc Exception in Method getByCode", he); return null; } catch (Exception e) { logger.error("Exception in getByCode", e); return null; } } LanguageDAOImpl(); Language getByCode(String code);  }