Index: topia2/src/java/org/codelutin/topia/persistence/hibernate/TopiaDAOHibernate.java diff -u topia2/src/java/org/codelutin/topia/persistence/hibernate/TopiaDAOHibernate.java:1.2 topia2/src/java/org/codelutin/topia/persistence/hibernate/TopiaDAOHibernate.java:1.3 --- topia2/src/java/org/codelutin/topia/persistence/hibernate/TopiaDAOHibernate.java:1.2 Wed Jan 4 13:21:51 2006 +++ topia2/src/java/org/codelutin/topia/persistence/hibernate/TopiaDAOHibernate.java Fri Jan 6 12:15:20 2006 @@ -23,9 +23,9 @@ * * @author poussin * - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Last update: $Date: 2006/01/04 13:21:51 $ by : $Author: bpoussin $ + * Last update: $Date: 2006/01/06 12:15:20 $ by : $Author: bpoussin $ */ package org.codelutin.topia.persistence.hibernate; @@ -49,15 +49,18 @@ * @author poussin * */ +// FIXME les Entity ne doivent pas forcement etendre TopiaEntity de cette +// facon on peut utiliser le framework sans la generation et sur des POJO +// existant. Cela implique de faire un peu attention au codage public class TopiaDAOHibernate extends TopiaDAOAbstract { + /* (non-Javadoc) * @see org.codelutin.topia.TopiaDAO#create() */ @Override - public Entity create(Object ... properties) throws TopiaException { + public Entity create(Map properties) throws TopiaException { Entity result = super.create(properties); - getContext().fireOnCreated(result); // on fait un save maintenant, car puisqu'on a creer l'entity au // travers du DAO, on s'attend a l'avoir a disposition tout de // suite pour les requetes sans avoir a faire un update dessus @@ -69,8 +72,11 @@ * @see org.codelutin.topia.TopiaDAO#update(Entity) */ public Entity update(Entity e) throws TopiaException { + Serializable id = getId(e); + getContext().fireVetoableUpdate(entityClass, id); try { getContext().getHibernate().saveOrUpdate(e); + getContext().fireOnUpdated(entityClass, id, e); return e; } catch (HibernateException eee) { throw new TopiaException(eee); @@ -81,8 +87,11 @@ * @see org.codelutin.topia.TopiaDAO#delete(Entity) */ public void delete(Entity e) throws TopiaException { + Serializable id = getId(e); + getContext().fireVetoableDelete(entityClass, id); try { getContext().getHibernate().delete(e); + getContext().fireOnDeleted(entityClass, id, e); } catch (HibernateException eee) { throw new TopiaException(eee); }