Hi Michelle,

On Aug 2, 2005, at 1:02 PM, Michelle Caisse wrote:

Hi,

We would like to recognize three ways of mapping PC object types as fields:

1. Serialized in the primary table (<field serialized="true">)
2. Embedded in the primary table (<field embedded="true">)
3. Referenced in a table of their own (<field embedded="false"> or embedded not specified)

For completeness, note that there are nine combinations:
Serialization True = ST
Serialization NotSpecified = SN
Serialization False = SF
Embedded True = ET
Embedded NotSpecified = EN
Embedded False = EF

ST ET invalid
ST EN ok (the following test cases)
ST EF ok but not tested
SN ET ok
SN EN ok
SN EF ok but not tested
SF ET ok but not tested
SF EN ok but not tested
SF ET ok but not tested



The existing fieldtypes classes cover many combinations of cases, but they do not cover serialized. I propose that we add 24 new fields to FieldsOfSimpleInterface, FieldsOfSimpleClass, FieldsOfObject, patterned on the existing fields for embedded, added to the end of the sequence to avoid renumbering (taking FieldsOfSimpleInterface as an example):

"serialized= true   private SimpleInterface SimpleInterface144",
"persistence-modifier= persistent  serialized= true   private SimpleInterface SimpleInterface145",
"persistence-modifier= persistent  serialized= true   private transient SimpleInterface SimpleInterface146",
"serialized= true   private volatile SimpleInterface SimpleInterface147",
"persistence-modifier= persistent  serialized= true   private volatile SimpleInterface SimpleInterface148",
"persistence-modifier= persistent  serialized= true   private transient volatile SimpleInterface SimpleInterface149"
"serialized= true   public SimpleInterface SimpleInterface150",
"persistence-modifier= persistent  serialized= true   public SimpleInterface SimpleInterface151",
"persistence-modifier= persistent  serialized= true   public transient SimpleInterface SimpleInterface152",
"serialized= true   public volatile SimpleInterface SimpleInterface153",
"persistence-modifier= persistent  serialized= true   public volatile SimpleInterface SimpleInterface154",
"persistence-modifier= persistent  serialized= true   public transient volatile SimpleInterface SimpleInterface155",
"serialized= true   protected SimpleInterface SimpleInterface156",
"persistence-modifier= persistent  serialized= true   protected SimpleInterface SimpleInterface157",
"persistence-modifier= persistent  serialized= true   protected transient SimpleInterface SimpleInterface158",
"serialized= true   protected volatile SimpleInterface SimpleInterface159",
"persistence-modifier= persistent  serialized= true   protected volatile SimpleInterface SimpleInterface160",
"persistence-modifier= persistent  serialized= true   protected transient volatile SimpleInterface SimpleInterface161",
"serialized= true   SimpleInterface SimpleInterface162",
"persistence-modifier= persistent  serialized= true   SimpleInterface SimpleInterface163",
"persistence-modifier= persistent  serialized= true   transient SimpleInterface SimpleInterface164",
"serialized= true   volatile SimpleInterface SimpleInterface165",
"persistence-modifier= persistent  serialized= true   volatile SimpleInterface SimpleInterface166",
"persistence-modifier= persistent  serialized= true   transient volatile SimpleInterface SimpleInterface167"

The mapping and schema for the three cases would be:
...
           <field name="SimpleInterface1" >
               <embedded>
                   <field name="intField" column="INTFIELD1"/>
                   <field name="stringField" column="STRINGFIELD1"/>
               </embedded>
           </field>
           <field name="SimpleInterface102" column="SIMPLEINTERFACE102" embedded="false">
                <foreign-key/>
            </field>
           <field name="SimpleInterface144" column="SIMPLEINTERFACE102" serialized="true"/>
           ...

CREATE TABLE FIELDSOFSIMPLEINTERFACE
(
   IDENTIFIER INTEGER NOT NULL,
   INTFIELD1 INTEGER, STRINGFIELD1 VARCHAR(1024),
   SIMPLEINTERFACE102 BIGINT REFERENCES SIMPLE_CLASS,
   SIMPLEINTERFACE144 LONG VARCHAR FOR BIT DATA,
...
)

Comments?

Looks good. 

Craig


-- Michelle



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!