Hi Mike

Actually the exception which I got, was indirectly related to this problem,
Because, The objects  Which We store and loaded again are not in same 
class instance.


I animal example, When we store a Dog and load it again
The  if (onwer.getAnimal() instanceof Dog)
    always returns false.

Thanks to any one help us.



Michael Colbert wrote:

>I've run into the same exception condition before.  Can you narrow down which
>method the FieldMolder is trying to invoke?
>
>Mike Colbert
>
>
>
>--- Reza Shahbazi <[EMAIL PROTECTED]> wrote:
>  
>
>>Hi All
>>
>>Problem: in JDO Inheritence
>>It works fine if I want to make my objects prisistent, as described in 
>>tips-tricks.html.
>>But when I try to load my master object (or instance of it) it doesn't 
>>properly load the dependent objects;
>>
>>Here is example:
>>I have four objects
>>
>>1-Animal.java
>>       2-Dog.java (extends Animal)
>>       3-Cat.java  (extends Animal)
>>
>>4- Owner.java   
>>        Animal  _animal; //instance varible
>>
>>Dog _dog= new Dog(...);
>>Owner _owner = new Owner(..);
>>_owener.setAnimal(_dog);
>>
>>db.begin
>>db.create(_dog);
>>db.create(_owner);
>>db.commit;
>>It works fine,  I have on record in Animal table and with same 
>>Identifier (primary key)
>>in dog table  (extra info are stored in dog table)
>>
>>
>>When I try ot load it
>>Owner _owner = (Owner)db.load(Owner.class,new Integer(1));
>>_owner.getAnimal() has the value of the Animal NOT Dog!!!!!
>>
>>I my real application I got :
>>java.lang.IllegalArgumentException: object is not an instance of 
>>declaring class
>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>    at 
>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>    at 
>>
>>    
>>
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  
>
>>    at java.lang.reflect.Method.invoke(Method.java:324)
>>    at org.exolab.castor.persist.FieldMolder.getValue(FieldMolder.java:253)
>>    at 
>>
>>    
>>
>org.exolab.castor.persist.ClassMolder.getActualIdentity(ClassMolder.java:2607)
>  
>
>>    at 
>>
>>    
>>
>org.exolab.castor.persist.ClassMolder.getActualIdentity(ClassMolder.java:2593)
>  
>
>>    at 
>>org.exolab.castor.persist.ClassMolder.getIdentity(ClassMolder.java:2581)
>>    at 
>>
>>    
>>
>org.exolab.castor.persist.ClassMolder.getRemovedIdsList(ClassMolder.java:1684)
>  
>
>>    at org.exolab.castor.persist.ClassMolder.preStore(ClassMolder.java:1291)
>>    at org.exolab.castor.persist.LockEngine.preStore(LockEngine.java:723)
>>    at 
>>
>>    
>>
>org.exolab.castor.persist.TransactionContext.prepare(TransactionContext.java:1409)
>  
>
>>    at 
>>org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:507)
>>    at com.symax.dms.testDB.create(testDB.java:247)
>>    at com.symax.dms.testDB.main(testDB.java:65)
>>
>>
>>Thanks
>>Reza
>>
>>----------------------------------------------------------- 
>>If you wish to unsubscribe from this mailing, send mail to
>>[EMAIL PROTECTED] with a subject of:
>>      unsubscribe castor-dev
>>
>>    
>>
>
>
>__________________________________________________
>Do you Yahoo!?
>New DSL Internet Access from SBC & Yahoo!
>http://sbc.yahoo.com
>
>----------------------------------------------------------- 
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev
>
>.
>
>  
>

Reply via email to