Replace deprecated Hibernate Expression with Restrictions.
This commit is contained in:
parent
572ac0ccd1
commit
935cdd031e
@ -3,7 +3,7 @@ package com.iluwatar.spell;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.criterion.Expression;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
||||
import com.iluwatar.common.DaoBaseImpl;
|
||||
|
||||
@ -22,7 +22,7 @@ public class SpellDaoImpl extends DaoBaseImpl<Spell> implements SpellDao {
|
||||
try {
|
||||
tx = session.beginTransaction();
|
||||
Criteria criteria = session.createCriteria(persistentClass);
|
||||
criteria.add(Expression.eq("name", name));
|
||||
criteria.add(Restrictions.eq("name", name));
|
||||
result = (Spell) criteria.uniqueResult();
|
||||
result.getSpellbook().getWizards().size();
|
||||
tx.commit();
|
||||
|
@ -3,7 +3,7 @@ package com.iluwatar.spellbook;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.criterion.Expression;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
||||
import com.iluwatar.common.DaoBaseImpl;
|
||||
|
||||
@ -22,7 +22,7 @@ public class SpellbookDaoImpl extends DaoBaseImpl<Spellbook> implements Spellboo
|
||||
try {
|
||||
tx = session.beginTransaction();
|
||||
Criteria criteria = session.createCriteria(persistentClass);
|
||||
criteria.add(Expression.eq("name", name));
|
||||
criteria.add(Restrictions.eq("name", name));
|
||||
result = (Spellbook) criteria.uniqueResult();
|
||||
result.getSpells().size();
|
||||
result.getWizards().size();
|
||||
|
@ -3,7 +3,7 @@ package com.iluwatar.wizard;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.criterion.Expression;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
||||
import com.iluwatar.common.DaoBaseImpl;
|
||||
import com.iluwatar.spellbook.Spellbook;
|
||||
@ -23,7 +23,7 @@ public class WizardDaoImpl extends DaoBaseImpl<Wizard> implements WizardDao {
|
||||
try {
|
||||
tx = session.beginTransaction();
|
||||
Criteria criteria = session.createCriteria(persistentClass);
|
||||
criteria.add(Expression.eq("name", name));
|
||||
criteria.add(Restrictions.eq("name", name));
|
||||
result = (Wizard) criteria.uniqueResult();
|
||||
for (Spellbook s: result.getSpellbooks()) {
|
||||
s.getSpells().size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user