User: dsundstrom
Date: 01/12/03 15:00:16
Modified: src/main/org/jboss/ejb/plugins BMPPersistenceManager.java
CMPFilePersistenceManager.java
CMPPersistenceManager.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.33 +25 -1 jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java
Index: BMPPersistenceManager.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/BMPPersistenceManager.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- BMPPersistenceManager.java 2001/11/24 20:43:22 1.32
+++ BMPPersistenceManager.java 2001/12/03 23:00:16 1.33
@@ -39,7 +39,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]">Andreas Schaefer</a>
-* @version $Revision: 1.32 $
+* @version $Revision: 1.33 $
*
* <p><b>Revisions:</b>
* <p><b>20010709 andreas schaefer:</b>
@@ -67,6 +67,11 @@
Method ejbPassivate;
Method ejbRemove;
+ /**
+ * Optional isModified method used by storeEntity
+ */
+ Method isModified;
+
HashMap createMethods = new HashMap();
HashMap postCreateMethods = new HashMap();
HashMap finderMethods = new HashMap();
@@ -110,6 +115,13 @@
createMethodCache( methods );
}
+ try
+ {
+ isModified = con.getBeanClass().getMethod("isModified", new Class[0]);
+ if (!isModified.getReturnType().equals(Boolean.TYPE))
+ isModified = null; // Has to have "boolean" as return type!
+ }
+ catch (NoSuchMethodException ignored) {}
}
/**
@@ -415,6 +427,18 @@
}
}
+ public boolean isModified(EntityEnterpriseContext ctx) throws Exception
+ {
+ if(isModified == null)
+ {
+ return true;
+ }
+
+ Object[] args = {};
+ Boolean modified = (Boolean) isModified.invoke(ctx.getInstance(), args);
+ return modified.booleanValue();
+ }
+
public void storeEntity(EntityEnterpriseContext ctx)
throws RemoteException
{
1.15 +27 -2
jboss/src/main/org/jboss/ejb/plugins/CMPFilePersistenceManager.java
Index: CMPFilePersistenceManager.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/CMPFilePersistenceManager.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- CMPFilePersistenceManager.java 2001/12/02 00:05:44 1.14
+++ CMPFilePersistenceManager.java 2001/12/03 23:00:16 1.15
@@ -38,7 +38,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
* <p><b>20010801 marc fleury:</b>
* <ul>
* <li>- insertion in cache upon create in now done in the instance interceptor
@@ -57,6 +57,11 @@
EntityContainer con;
File dir;
Field idField;
+
+ /**
+ * Optional isModified method used by storeEntity
+ */
+ Method isModified;
// Static --------------------------------------------------------
@@ -74,6 +79,14 @@
String ejbName = con.getBeanMetaData().getEjbName();
dir = new
File(getClass().getResource("/db/"+ejbName+"/db.properties").getFile()).getParentFile();
idField = con.getBeanClass().getField("id");
+
+ try
+ {
+ isModified = con.getBeanClass().getMethod("isModified", new Class[0]);
+ if (!isModified.getReturnType().equals(Boolean.TYPE))
+ isModified = null; // Has to have "boolean" as return type!
+ }
+ catch (NoSuchMethodException ignored) {}
}
public void start()
@@ -285,7 +298,19 @@
throw new EJBException("Store failed", e);
}
}
-
+
+ public boolean isModified(EntityEnterpriseContext ctx) throws Exception
+ {
+ if(isModified == null)
+ {
+ return true;
+ }
+
+ Object[] args = {};
+ Boolean modified = (Boolean) isModified.invoke(ctx.getInstance(), args);
+ return modified.booleanValue();
+ }
+
public void storeEntity(EntityEnterpriseContext ctx)
{
storeEntity(ctx.getId(), ctx.getInstance());
1.37 +6 -1 jboss/src/main/org/jboss/ejb/plugins/CMPPersistenceManager.java
Index: CMPPersistenceManager.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/CMPPersistenceManager.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- CMPPersistenceManager.java 2001/12/02 00:05:44 1.36
+++ CMPPersistenceManager.java 2001/12/03 23:00:16 1.37
@@ -44,7 +44,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Dan Christopherson</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>
- * @version $Revision: 1.36 $
+ * @version $Revision: 1.37 $
*
* Revisions:
* 20010621 Bill Burke: removed loadEntities call because CMP read-ahead is now
@@ -382,6 +382,11 @@
invokeLoad(ctx);
}
+ public boolean isModified(EntityEnterpriseContext ctx) throws Exception
+ {
+ return store.isModified(ctx);
+ }
+
public void storeEntity(EntityEnterpriseContext ctx)
throws RemoteException
{
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development