db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Re: Collections of interfaces
Date Fri, 29 Apr 2005 19:46:23 GMT
Hi Andy,

After I wrote the message I realized I had no idea what I was talking 

On Apr 29, 2005, at 12:33 PM, Andy Jefferson wrote:

>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects
>> Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd">
>> <jdo>
>> <package name="org.apache.jdo.tck.pc.fieldtypes">
>> <class name="SimpleClass" identity-type="application"    
>>    objectid-class="org.apache.jdo.tck.pc.fieldtypes.SimpleClass$Oid">
>>    <implements name="SimpleInterface">
>> <field name="id" primary-key="true"/>
>> </class>
>> </package>
>> </jdo>
>> So is it sufficient that the SimpleInterface metadata be ahead of the
>> SimpleClass metadata in the .jdo file?
> What "SimpleInterface" MetaData ? It's an interface, and since JPOX 
> doesn't
> support specification of <interface> as such yet then it doesn't have 
> any
> MetaData. I assume you mean the MetaData for the class that has a 
> field of
> type SimpleInterface ? If that is in the same file as the MetaData for
> SimpleClass then all should be ok.
> If they are in different files then you need to let JPOX know about the
> implementation classes somehow (it can't just go off scanning around 
> the
> CLASSPATH). There are many ways ... the simplest and one that is
> implementation-independent would be to call pm.getExtent(SimpleClass) 
> which
> will load the MetaData for SimpleClass.

Ok, now I understand. You need to have metadata for SimpleClass known 
to the implementation by the time the FieldsOfSimpleInterface is 
loaded, because FOSI doesn't know about SimpleClass; it only knows 
about SimpleInterface.

There is a similar issue if you do getObjectById and pass in an oid of 
a class that the implementation hasn't seen yet. There's no way for the 
implementation to find the class that has that oid class.

> -- 
> Andy
> Java Persistent Objects JDO - JPOX
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

View raw message