User: vharcq
Date: 01/05/02 04:03:16
Modified: src/main/org/jboss/ejb/plugins CMPPersistenceManager.java
Log:
Nested properties of cmp entity beans can now be private
Revision Changes Path
1.18 +34 -30 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- CMPPersistenceManager.java 2001/02/28 00:03:51 1.17
+++ CMPPersistenceManager.java 2001/05/02 11:03:16 1.18
@@ -42,7 +42,7 @@
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
-* @version $Revision: 1.17 $
+* @version $Revision: 1.18 $
*/
public class CMPPersistenceManager
implements EntityPersistenceManager {
@@ -129,7 +129,7 @@
// The EJB 1.1 specification is not entirely clear about this,
// the EJB 2.0 spec is, see page 169.
// Robustness is more important than raw speed for most server
- // applications, and not resetting atrribute values result in
+ // applications, and not resetting atrribute values result in
// *very* weird errors (old states re-appear in different instances and the
// developer thinks he's on drugs).
@@ -142,33 +142,38 @@
i.hasNext();) {
try {
// get the field declaration
- cmpField = ejbClass.getField((String)i.next());
- cmpFieldType = cmpField.getType();
- // find the type of the field and reset it
- // to the default value
- if (cmpFieldType.equals(boolean.class)) {
- cmpField.setBoolean(instance,false);
- } else if (cmpFieldType.equals(byte.class)) {
- cmpField.setByte(instance,(byte)0);
- } else if (cmpFieldType.equals(int.class)) {
- cmpField.setInt(instance,0);
- } else if (cmpFieldType.equals(long.class)) {
- cmpField.setLong(instance,0L);
- } else if (cmpFieldType.equals(short.class)) {
- cmpField.setShort(instance,(short)0);
- } else if (cmpFieldType.equals(char.class)) {
- cmpField.setChar(instance,'\u0000');
- } else if (cmpFieldType.equals(double.class))
{
- cmpField.setDouble(instance,0d);
- } else if (cmpFieldType.equals(float.class)) {
- cmpField.setFloat(instance,0f);
-
- //} else if (... cmr collection in ejb2.0...) {
- //
cmpField.set(instance,someNewCollection?);
-
- } else {
- cmpField.set(instance,null);
- }
+ try{
+ cmpField = ejbClass.getField((String)i.next());
+ cmpFieldType = cmpField.getType();
+ // find the type of the field and reset it
+ // to the default value
+ if (cmpFieldType.equals(boolean.class)) {
+ cmpField.setBoolean(instance,false);
+ } else if (cmpFieldType.equals(byte.class)) {
+ cmpField.setByte(instance,(byte)0);
+ } else if (cmpFieldType.equals(int.class)) {
+ cmpField.setInt(instance,0);
+ } else if (cmpFieldType.equals(long.class)) {
+ cmpField.setLong(instance,0L);
+ } else if (cmpFieldType.equals(short.class)) {
+ cmpField.setShort(instance,(short)0);
+ } else if (cmpFieldType.equals(char.class)) {
+ cmpField.setChar(instance,'\u0000');
+ } else if (cmpFieldType.equals(double.class)) {
+ cmpField.setDouble(instance,0d);
+ } else if (cmpFieldType.equals(float.class)) {
+ cmpField.setFloat(instance,0f);
+
+ //} else if (... cmr collection in ejb2.0...) {
+ // cmpField.set(instance,someNewCollection?);
+
+ } else {
+ cmpField.set(instance,null);
+ }
+ } catch (NoSuchFieldException e){
+ // will be here with dependant value object's private
attributes
+ // should not be a problem
+ }
} catch (Exception e) {
throw new EJBException(e);
}
@@ -176,7 +181,6 @@
// Call ejbCreate on the target bean
try {
-
createMethod.invoke(ctx.getInstance(), args);
} catch (IllegalAccessException e)
{
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development