Reformat rest of the design patterns - Issue #224

This commit is contained in:
Ankur Kaushal
2015-11-01 21:29:13 -05:00
parent 449340bd2b
commit 306b1f3d31
337 changed files with 6744 additions and 6851 deletions
@@ -15,28 +15,27 @@ import com.iluwatar.servicelayer.spellbook.Spellbook;
*/
public class WizardDaoImpl extends DaoBaseImpl<Wizard> implements WizardDao {
@Override
public Wizard findByName(String name) {
Session session = getSession();
Transaction tx = null;
Wizard result = null;
try {
tx = session.beginTransaction();
Criteria criteria = session.createCriteria(persistentClass);
criteria.add(Restrictions.eq("name", name));
result = (Wizard) criteria.uniqueResult();
for (Spellbook s: result.getSpellbooks()) {
s.getSpells().size();
}
tx.commit();
}
catch (Exception e) {
if (tx!=null) tx.rollback();
throw e;
}
finally {
session.close();
}
return result;
}
@Override
public Wizard findByName(String name) {
Session session = getSession();
Transaction tx = null;
Wizard result = null;
try {
tx = session.beginTransaction();
Criteria criteria = session.createCriteria(persistentClass);
criteria.add(Restrictions.eq("name", name));
result = (Wizard) criteria.uniqueResult();
for (Spellbook s : result.getSpellbooks()) {
s.getSpells().size();
}
tx.commit();
} catch (Exception e) {
if (tx != null)
tx.rollback();
throw e;
} finally {
session.close();
}
return result;
}
}