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 Default allows-null for fields mapped to superclass tables
Date Mon, 18 Apr 2005 22:00:15 GMT
Javadogs,

On Apr 17, 2005, at 9:44 PM, Michelle Caisse wrote:

>> I have some metadata notes for the company model (package-derby.orm):
>>
>> 1. the column salary must allow null, and if we look in the java 
>> class, it's a
>> double value. Should the metadata explicit says the column is null or 
>> it's
>> implied by the fact it's a subclass using superclass-table strategy?
>>
>>        <class name="FullTimeEmployee">
>>            <inheritance strategy="superclass-table"/>
>>            <field name="salary" column="SALARY"/>
>>        </class>
>>
The SALARY column must be nullable because it's in a class that is 
mapped to its superclass table. I believe that the user should not have 
to tell the JDO implementation that it's nullable.

Other opinions?

Should I add words to the spec that make this explicit? For example, in 
18.5, change

<spec>
The allows-null attribute specifies whether null values are allowed in 
the column, and is defaulted based on the type of the field being 
mapped. The default is “true” for reference field types and “false” for 
primitive field types.
</spec>

to:

<spec>
The allows-null attribute specifies whether null values are allowed in 
the column, and is defaulted based on the type of the field being 
mapped. The default is “true” for reference field types and fields 
mapped to superclass tables; and “false” for primitive field types.
</spec>

Craig
>>
>>        <class name="FullTimeEmployee">
>>            <inheritance strategy="superclass-table"/>
>>            <field name="salary">
>>            	<column name="SALARY" allows-null="true"/>
>>            </field>
>>        </class>
>>
>> 2. The mapped-by attribute for fields employees and fundedEmps is not 
>> using the
>> correct case. The below is correct
>>
>>        <class name="Department" table="departments">
>>            <datastore-identity strategy="identity" column="ID"/>
>>            <field name="name" column="NAME"/>
>>            <field name="company" column="COMPANYID"/>
>>            <field name="employees" mapped-by="department"/>
>>            <field name="fundedEmps" mapped-by="fundingDept"/>
>>        </class>
>>
>> 3. The field "insid" must be removed from the Insurance class when 
>> under the
>> orm/datastoreidentity folder.
>>
>>        <class name="Insurance" table="insuranceplans">
>>            <inheritance strategy="new-table">
>>                <discriminator strategy="class-name" 
>> column="DISCRIMINATOR"/>
>>            </inheritance>
>>            <field name="insid" column="INSID" primary-key="true"/>
>>
>> Regards,
>>
>> Erik Bengtson
>>
>
>
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!

Mime
View raw message