You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2004/07/23 13:36:00 UTC
cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess AnonymousPersistentFieldForInheritance.java
arminw 2004/07/23 04:36:00
Modified: src/java/org/apache/ojb/broker/metadata/fieldaccess
AnonymousPersistentFieldForInheritance.java
Log:
bug fix by Sergey Udovenko,
AnonymousPersistentFieldForInheritance now use factory methods for pc objects too.
<snip>
I guess that I'm getting it because the base class supposed to be created by
the factory as well (ctor is protected).
The problem is in method AnonymousPersistentFieldForInheritance.get() that
uses ClassHelper.newInstance(cld.getBaseClass()); to create that base class.
</snip>
Revision Changes Path
1.12 +6 -5 db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AnonymousPersistentFieldForInheritance.java
Index: AnonymousPersistentFieldForInheritance.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AnonymousPersistentFieldForInheritance.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AnonymousPersistentFieldForInheritance.java 4 Apr 2004 23:53:35 -0000 1.11
+++ AnonymousPersistentFieldForInheritance.java 23 Jul 2004 11:36:00 -0000 1.12
@@ -15,12 +15,12 @@
* limitations under the License.
*/
+import java.util.Vector;
+
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.MetadataException;
import org.apache.ojb.broker.util.ClassHelper;
-import java.util.Vector;
-
/**
* @author Houar TINE
* @version $Id$
@@ -75,11 +75,12 @@
{
try
{
- value = ClassHelper.newInstance(cld.getBaseClass());
+ ClassDescriptor baseCld = cld.getRepository().getDescriptorFor(cld.getBaseClass());
+ value = ClassHelper.buildNewObjectInstance(baseCld);
}
catch (Exception e)
{
- throw new MetadataException(e);
+ throw new MetadataException("Can't create new base class object for '" + cld.getBaseClass()+"'", e);
}
putToFieldCache(obj, value);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org