mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-25 13:32:30 +00:00
Change createOrUpdate() to use Hibernate session.saveOrUpdate().
This commit is contained in:
parent
1e896c14d6
commit
2f2c6bc3d8
@ -46,6 +46,7 @@ import java.util.List;
|
|||||||
* {@link Dao} implementation that uses Hibernate for persistence.
|
* {@link Dao} implementation that uses Hibernate for persistence.
|
||||||
*
|
*
|
||||||
* @author Ben Alex
|
* @author Ben Alex
|
||||||
|
* @author Matthew Porter
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class DaoHibernate extends HibernateDaoSupport implements Dao,
|
public class DaoHibernate extends HibernateDaoSupport implements Dao,
|
||||||
@ -74,12 +75,9 @@ public class DaoHibernate extends HibernateDaoSupport implements Dao,
|
|||||||
|
|
||||||
public PersistableEntity createOrUpdate(PersistableEntity value) {
|
public PersistableEntity createOrUpdate(PersistableEntity value) {
|
||||||
Assert.notNull(value);
|
Assert.notNull(value);
|
||||||
|
getHibernateTemplate().saveOrUpdate(value);
|
||||||
|
|
||||||
if (value.getInternalId() == null) {
|
return readId(value.getInternalId());
|
||||||
return create(value);
|
|
||||||
} else {
|
|
||||||
return update(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(PersistableEntity value) {
|
public void delete(PersistableEntity value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user