Change createOrUpdate() to use Hibernate session.saveOrUpdate().

This commit is contained in:
Matthew Porter 2005-03-31 02:52:05 +00:00
parent 1e896c14d6
commit 2f2c6bc3d8
1 changed files with 3 additions and 5 deletions

View File

@ -46,6 +46,7 @@ import java.util.List;
* {@link Dao} implementation that uses Hibernate for persistence.
*
* @author Ben Alex
* @author Matthew Porter
* @version $Id$
*/
public class DaoHibernate extends HibernateDaoSupport implements Dao,
@ -74,12 +75,9 @@ public class DaoHibernate extends HibernateDaoSupport implements Dao,
public PersistableEntity createOrUpdate(PersistableEntity value) {
Assert.notNull(value);
getHibernateTemplate().saveOrUpdate(value);
if (value.getInternalId() == null) {
return create(value);
} else {
return update(value);
}
return readId(value.getInternalId());
}
public void delete(PersistableEntity value) {