User: dsundstrom Date: 01/12/03 15:00:16 Modified: src/main/org/jboss/ejb EntityContainer.java EntityPersistenceManager.java EntityPersistenceStore.java Log: Moved isModified call back into persistence manager. Is modified is still checked before store is called. This is necessary for CMP 2, because the bean provider can not know if the bean has been modfied by a relationship. Revision Changes Path 1.59 +2 -27 jboss/src/main/org/jboss/ejb/EntityContainer.java Index: EntityContainer.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- EntityContainer.java 2001/11/26 03:12:24 1.58 +++ EntityContainer.java 2001/12/03 23:00:16 1.59 @@ -41,7 +41,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a> * @author <a href="[EMAIL PROTECTED]">Bill Burke</a> * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> - * @version $Revision: 1.58 $ + * @version $Revision: 1.59 $ * * <p><b>Revisions:</b> * @@ -110,11 +110,6 @@ protected long removeCount = 0; /** - * Optional isModified method used by storeEntity - */ - protected Method isModified; - - /** * This provides a way to find the entities that are part of a given * transaction EntitySynchronizationInterceptor and InstanceSynchronization * manage this instance. @@ -316,15 +311,6 @@ in = in.getNext(); } - try - { - isModified = getBeanClass().getMethod("isModified", new Class[0]); - if (!isModified.getReturnType().equals(Boolean.TYPE)) - isModified = null; // Has to have "boolean" as return type! - } - catch (NoSuchMethodException ignored) {} - - // Reset classloader Thread.currentThread().setContextClassLoader(oldCl); } @@ -640,18 +626,7 @@ { if (ctx.getId() != null) { - boolean dirty = true; - // Check isModified bean method flag - if (isModified != null) - { - Object[] args = {}; - Boolean modified = (Boolean) isModified.invoke(ctx.getInstance(), args); - dirty = modified.booleanValue(); - } - - // Store entity - if (dirty) - { + if(getPersistenceManager().isModified(ctx)) { getPersistenceManager().storeEntity(ctx); } } 1.11 +10 -1 jboss/src/main/org/jboss/ejb/EntityPersistenceManager.java Index: EntityPersistenceManager.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityPersistenceManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- EntityPersistenceManager.java 2001/08/03 17:15:43 1.10 +++ EntityPersistenceManager.java 2001/12/03 23:00:16 1.11 @@ -27,7 +27,7 @@ * @see EntityContainer * * @author <a href="mailto:[EMAIL PROTECTED]">Rickard Öberg</a> - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public interface EntityPersistenceManager extends ContainerPlugin, StatisticsProvider @@ -115,6 +115,15 @@ void loadEntity(EntityEnterpriseContext instance) throws RemoteException; + /** + * This method is used to determine if an entity should be stored. + * + * @param instance the instance to check + * @return true, if the entity has been modified + * @throws Exception thrown if some system exception occurs + */ + boolean isModified(EntityEnterpriseContext instance) throws Exception; + /** * This method is called whenever an entity shall be stored to the * underlying storage. The persistence manager must call ejbStore on the 1.11 +10 -1 jboss/src/main/org/jboss/ejb/EntityPersistenceStore.java Index: EntityPersistenceStore.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityPersistenceStore.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- EntityPersistenceStore.java 2001/12/02 00:05:44 1.10 +++ EntityPersistenceStore.java 2001/12/03 23:00:16 1.11 @@ -26,7 +26,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Rickard Öberg</a> * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> * @author <a href="mailto:[EMAIL PROTECTED]">Simone Bordet</a> - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public interface EntityPersistenceStore extends ContainerPlugin @@ -140,6 +140,15 @@ void loadEntity(EntityEnterpriseContext instance) throws RemoteException; + /** + * This method is used to determine if an entity should be stored. + * + * @param instance the instance to check + * @return true, if the entity has been modified + * @throws Exception thrown if some system exception occurs + */ + boolean isModified(EntityEnterpriseContext instance) throws Exception; + /** * This method is called whenever an entity shall be stored to the * underlying storage. The persistence manager must call ejbStore on the
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development