You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Craig Russell <cr...@sun.com> on 2006/04/16 07:32:23 UTC

Re: [Fwd: last issue with completeness test]

Hi Erik,

It's probably not related to the problem, but why do you declare an
index defined on the discriminator columns in the metadata?

The only other odd thing is the change to projects: <property
name="projects" mapped-by="members"/>

There's nothing else that I can see that would cause a problem
deleting instances. Where does the error show up?

Craig

P.S. until Monday, please reply to papajdo@gmail.com in addition to jdo-dev.

On 4/15/06, Michelle Caisse <Mi...@sun.com> wrote:
>
>
>  -------- Original Message --------
> Subject: last issue with completeness test
> Date: Sat, 15 Apr 2006 18:51:11 -0700
> From: Erik Bengtson <er...@jpox.org>
> Reply-To: jdo-dev@db.apache.org
> To: jdo-dev@db.apache.org
>
>  Hi,
>
> JPOX now passes completeness interface test in my local workspace, but
> apparently the tables are not cleaned out completely on tear down. It passes
> if
> it is the only configuration enabled. Can someone take a look on that?
>
> Here my changes to the schema and metadata files adding discriminator column
> to
> tables.
>
> Index:
> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
> ===================================================================
> ---
> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
> (revision
> 391636)
> +++
> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
> (working copy)
> @@ -130,6 +130,7 @@
>  STATE CHAR(2),
>  ZIPCODE CHAR(5),
>  COUNTRY VARCHAR(64),
> + DISCRIMINATOR VARCHAR(255),
>  CONSTRAINT COMPS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>  );
>
> @@ -139,6 +140,7 @@
>  NAME VARCHAR(32) NOT NULL,
>  EMP_OF_THE_MONTH INTEGER,
>  COMPANYID INTEGER REFERENCES companies,
> + DISCRIMINATOR VARCHAR(255),
>  CONSTRAINT DEPTS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>  );
>
> @@ -185,6 +187,7 @@
>  PROJID INTEGER NOT NULL,
>  NAME VARCHAR(32) NOT NULL,
>  BUDGET DECIMAL(11,2) NOT NULL,
> + DISCRIMINATOR VARCHAR(255),
>  CONSTRAINT PROJS_UK UNIQUE (PROJID),
>  CONSTRAINT PROJS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>  );
> Index:
> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
> ===================================================================
> ---
> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
> (revision
> 391636)
> +++
> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
> (working
> copy)
> @@ -182,6 +182,7 @@
>  STATE CHAR(2),
>  ZIPCODE CHAR(5),
>  COUNTRY VARCHAR(64),
> + DISCRIMINATOR VARCHAR(255),
>  CONSTRAINT COMPS_PK PRIMARY KEY (ID)
>  );
>
> @@ -190,6 +191,7 @@
>  NAME VARCHAR(32) NOT NULL,
>  EMP_OF_THE_MONTH INTEGER,
>  COMPANYID INTEGER REFERENCES companies,
> + DISCRIMINATOR VARCHAR(255),
>  CONSTRAINT DEPTS_PK PRIMARY KEY (ID)
>  );
>
> @@ -232,6 +234,7 @@
>  PROJID INTEGER NOT NULL,
>  NAME VARCHAR(32) NOT NULL,
>  BUDGET DECIMAL(11,2) NOT NULL,
> + DISCRIMINATOR VARCHAR(255),
>  CONSTRAINT PROJS_PK PRIMARY KEY (PROJID)
>  );
>
> Index:
> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
> ===================================================================
> ---
> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
> (revision
> 388908)
> +++
> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
> (working
> copy)
> @@ -11,6 +11,11 @@
>
>  <class name="Company" table="companies">
>  <datastore-identity strategy="identity"
> column="DATASTORE_IDENTITY"/>
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <field name="companyid" column="ID"/>
>  <field name="name" column="NAME">
>  <column name="NAME" sql-type="VARCHAR"/>
> @@ -43,6 +48,11 @@
>
>  <class name="Department" table="departments">
>  <datastore-identity strategy="identity"
> column="DATASTORE_IDENTITY"/>
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <field name="deptid" column="ID"/>
>  <field name="name" column="NAME"/>
>  <field name="company" column="COMPANYID"/>
> @@ -149,6 +159,11 @@
>
>  <class name="Project" table="projects">
>  <datastore-identity strategy="identity"
> column="DATASTORE_IDENTITY"/>
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <field name="projid" column="PROJID"/>
>  <field name="name" column="NAME"/>
>  <field name="budget">
> @@ -168,6 +183,11 @@
>
>  <interface name="ICompany" table="companies">
>  <datastore-identity strategy="identity"
> column="DATASTORE_IDENTITY"/>
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <property name="companyid" column="ID"/>
>  <property name="name" column="NAME">
>  <column name="NAME" sql-type="VARCHAR"/>
> @@ -188,6 +208,11 @@
>
>  <interface name="IDepartment" table="departments">
>  <datastore-identity strategy="identity"
> column="DATASTORE_IDENTITY"/>
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <property name="deptid" column="ID"/>
>  <property name="name" column="NAME"/>
>  <property name="company" column="COMPANYID"/>
> @@ -306,6 +331,11 @@
>
>  <interface name="IProject" table="projects">
>  <datastore-identity strategy="identity"
> column="DATASTORE_IDENTITY"/>
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <property name="projid" column="PROJID"/>
>  <property name="name" column="NAME"/>
>  <property name="budget">
> Index:
> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
> ===================================================================
> ---
> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
> (revision
> 388908)
> +++
> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
> (working
> copy)
> @@ -10,6 +10,11 @@
>  <package name="org.apache.jdo.tck.pc.company">
>
>  <class name="Company" table="companies">
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <field name="companyid" column="ID"/>
>  <field name="name" column="NAME">
>  <column name="NAME" sql-type="VARCHAR"/>
> @@ -29,6 +34,11 @@
>  </class>
>
>  <class name="Department" table="departments">
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <field name="deptid" column="ID"/>
>  <field name="name" column="NAME"/>
>  <field name="company" column="COMPANYID"/>
> @@ -144,6 +154,11 @@
>  </class>
>
>  <class name="Project" table="projects">
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <field name="projid" column="PROJID"/>
>  <field name="name" column="NAME"/>
>  <field name="budget">
> @@ -164,6 +179,11 @@
>  </class>
>
>  <interface name="ICompany" table="companies">
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <property name="companyid" column="ID"/>
>  <property name="name" column="NAME">
>  <column name="NAME" sql-type="VARCHAR"/>
> @@ -183,6 +203,11 @@
>  </interface>
>
>  <interface name="IDepartment" table="departments">
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <property name="deptid" column="ID"/>
>  <property name="name" column="NAME"/>
>  <property name="company" column="COMPANYID"/>
> @@ -224,8 +249,7 @@
>  <foreign-key/>
>  </property>
>  <property name="reviewedProjects" mapped-by="reviewers">
> - </property>
> - <property name="projects" mapped-by="members"/>
> + </property> <property name="projects"
> mapped-by="members"/>
>  <property name="team" mapped-by="manager"/>
>  <property name="hradvisees" mapped-by="hradvisor"/>
>  </interface>
> @@ -298,6 +322,11 @@
>  </interface>
>
>  <interface name="IProject" table="projects">
> + <inheritance strategy="new-table">
> + <discriminator strategy="class-name" column="DISCRIMINATOR">
> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
> + </discriminator>
> + </inheritance>
>  <property name="projid" column="PROJID"/>
>  <property name="name" column="NAME"/>
>  <property name="budget">
>
>
>

Re: [Fwd: last issue with completeness test]

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Jörg,

On Apr 20, 2006, at 5:40 AM, Jörg von Frantzius wrote:

> Hello Craig,
>
> I think that if we have includeSubclasses==true that the WHERE  
> clause generated by JPOX will OR all possible values of the  
> discriminator column. Won't that also be sped up by an index on the  
> discriminator column?

Not necessarily. It depends on how selective the indexes are in the  
query or navigation. Let's take an example where you have Employees  
in your Person table. You query for Employee where salary > 100000.  
Your SQL statement is: SELECT ID, DISCRIMINATOR, NAME, SALARY FROM  
PERSON p WHERE p.SALARY > 10000 AND p.DISCRIMINATOR IN  
('org.apache.jdo.tck.pc.company.Employee',  
org.apache.jdo.tck.pc.company.PartTimeEmployee',  
'org.apache.jdo.tck.pc.company.FullTimeEmployee')

If the index on SALARY is more selective than the index on  
DISCRIMINATOR, you will do an index scan of the table using the  
SALARY index. And you would only examine persons that passed the  
SALARY test to reject those that did not pass the DISCRIMINATOR test.  
If instead, the database chose the DISCRIMINATOR index, it would  
examine all employees to see if they passed the SALARY test.

So it's not clear to me that an index on DISCRIMINATOR is useful in  
this case. It depends on whether there exists a more selective index  
than DISCRIMINATOR. This is similar to why you usually don't index  
BOOLEAN or BIT columns. Not good selectivity.

Craig
>
> Regards,
> Jörg
>
> Craig L Russell schrieb:
>> Hi Jörg,
>>
>> Just to be clear: this improves performance only in the case that  
>> you know what specific class you are looking for (you have a  
>> relationship to a specific most-derived subclass) and there is not  
>> another more appropriate index to optimize on. So it's worthless  
>> in the generic query use case because there will typically be a  
>> more restrictive index, and of little value in the navigation case  
>> because you are joining on a foreign key anyway. So it's only  
>> useful for a table scan of a most-derived subclass or superclass  
>> Extent with includeSubclasses==false.
>>
>> This came out more harshly than I thought it would when I started.  
>> Is there a good use case for indexing the discriminator column?
>>
>> Regards,
>>
>> Craig
>>
>> On Apr 18, 2006, at 9:22 AM, Jörg von Frantzius wrote:
>>
>>> Craig Russell schrieb:
>>>> Hi Erik,
>>>>
>>>> It's probably not related to the problem, but why do you declare an
>>>> index defined on the discriminator columns in the metadata?
>>>>
>>> Yes I'm not Erik but still: in our production system we do that  
>>> to increase performance of queries. We'd even like to have that  
>>> by default.
>


Re: [Fwd: last issue with completeness test]

Posted by Jörg von Frantzius <jo...@artnology.com>.
Hello Craig,

I think that if we have includeSubclasses==true that the WHERE clause 
generated by JPOX will OR all possible values of the discriminator 
column. Won't that also be sped up by an index on the discriminator column?

Regards,
Jörg

Craig L Russell schrieb:
> Hi Jörg,
>
> Just to be clear: this improves performance only in the case that you 
> know what specific class you are looking for (you have a relationship 
> to a specific most-derived subclass) and there is not another more 
> appropriate index to optimize on. So it's worthless in the generic 
> query use case because there will typically be a more restrictive 
> index, and of little value in the navigation case because you are 
> joining on a foreign key anyway. So it's only useful for a table scan 
> of a most-derived subclass or superclass Extent with 
> includeSubclasses==false.
>
> This came out more harshly than I thought it would when I started. Is 
> there a good use case for indexing the discriminator column?
>
> Regards,
>
> Craig
>
> On Apr 18, 2006, at 9:22 AM, Jörg von Frantzius wrote:
>
>> Craig Russell schrieb:
>>> Hi Erik,
>>>
>>> It's probably not related to the problem, but why do you declare an
>>> index defined on the discriminator columns in the metadata?
>>>   
>> Yes I'm not Erik but still: in our production system we do that to 
>> increase performance of queries. We'd even like to have that by default.


Re: [Fwd: last issue with completeness test]

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Jörg,

Just to be clear: this improves performance only in the case that you  
know what specific class you are looking for (you have a relationship  
to a specific most-derived subclass) and there is not another more  
appropriate index to optimize on. So it's worthless in the generic  
query use case because there will typically be a more restrictive  
index, and of little value in the navigation case because you are  
joining on a foreign key anyway. So it's only useful for a table scan  
of a most-derived subclass or superclass Extent with  
includeSubclasses==false.

This came out more harshly than I thought it would when I started. Is  
there a good use case for indexing the discriminator column?

Regards,

Craig

On Apr 18, 2006, at 9:22 AM, Jörg von Frantzius wrote:

> Craig Russell schrieb:
>> Hi Erik,
>>
>> It's probably not related to the problem, but why do you declare an
>> index defined on the discriminator columns in the metadata?
>>
> Yes I'm not Erik but still: in our production system we do that to  
> increase performance of queries. We'd even like to have that by  
> default.
>> The only other odd thing is the change to projects: <property
>> name="projects" mapped-by="members"/>
>>
>> There's nothing else that I can see that would cause a problem
>> deleting instances. Where does the error show up?
>>
>> Craig
>>
>> P.S. until Monday, please reply to papajdo@gmail.com in addition  
>> to jdo-dev.
>>
>> On 4/15/06, Michelle Caisse <Mi...@sun.com> wrote:
>>
>>>  -------- Original Message --------
>>> Subject: last issue with completeness test
>>> Date: Sat, 15 Apr 2006 18:51:11 -0700
>>> From: Erik Bengtson <er...@jpox.org>
>>> Reply-To: jdo-dev@db.apache.org
>>> To: jdo-dev@db.apache.org
>>>
>>>  Hi,
>>>
>>> JPOX now passes completeness interface test in my local  
>>> workspace, but
>>> apparently the tables are not cleaned out completely on tear  
>>> down. It passes
>>> if
>>> it is the only configuration enabled. Can someone take a look on  
>>> that?
>>>
>>> Here my changes to the schema and metadata files adding  
>>> discriminator column
>>> to
>>> tables.
>>>
>>> Index:
>>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>>> (revision
>>> 391636)
>>> +++
>>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>>> (working copy)
>>> @@ -130,6 +130,7 @@
>>>  STATE CHAR(2),
>>>  ZIPCODE CHAR(5),
>>>  COUNTRY VARCHAR(64),
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT COMPS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>>  );
>>>
>>> @@ -139,6 +140,7 @@
>>>  NAME VARCHAR(32) NOT NULL,
>>>  EMP_OF_THE_MONTH INTEGER,
>>>  COMPANYID INTEGER REFERENCES companies,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT DEPTS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>>  );
>>>
>>> @@ -185,6 +187,7 @@
>>>  PROJID INTEGER NOT NULL,
>>>  NAME VARCHAR(32) NOT NULL,
>>>  BUDGET DECIMAL(11,2) NOT NULL,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT PROJS_UK UNIQUE (PROJID),
>>>  CONSTRAINT PROJS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>>  );
>>> Index:
>>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>>> (revision
>>> 391636)
>>> +++
>>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>>> (working
>>> copy)
>>> @@ -182,6 +182,7 @@
>>>  STATE CHAR(2),
>>>  ZIPCODE CHAR(5),
>>>  COUNTRY VARCHAR(64),
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT COMPS_PK PRIMARY KEY (ID)
>>>  );
>>>
>>> @@ -190,6 +191,7 @@
>>>  NAME VARCHAR(32) NOT NULL,
>>>  EMP_OF_THE_MONTH INTEGER,
>>>  COMPANYID INTEGER REFERENCES companies,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT DEPTS_PK PRIMARY KEY (ID)
>>>  );
>>>
>>> @@ -232,6 +234,7 @@
>>>  PROJID INTEGER NOT NULL,
>>>  NAME VARCHAR(32) NOT NULL,
>>>  BUDGET DECIMAL(11,2) NOT NULL,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT PROJS_PK PRIMARY KEY (PROJID)
>>>  );
>>>
>>> Index:
>>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (revision
>>> 388908)
>>> +++
>>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (working
>>> copy)
>>> @@ -11,6 +11,11 @@
>>>
>>>  <class name="Company" table="companies">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="companyid" column="ID"/>
>>>  <field name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -43,6 +48,11 @@
>>>
>>>  <class name="Department" table="departments">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="deptid" column="ID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="company" column="COMPANYID"/>
>>> @@ -149,6 +159,11 @@
>>>
>>>  <class name="Project" table="projects">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="projid" column="PROJID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="budget">
>>> @@ -168,6 +183,11 @@
>>>
>>>  <interface name="ICompany" table="companies">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="companyid" column="ID"/>
>>>  <property name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -188,6 +208,11 @@
>>>
>>>  <interface name="IDepartment" table="departments">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="deptid" column="ID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="company" column="COMPANYID"/>
>>> @@ -306,6 +331,11 @@
>>>
>>>  <interface name="IProject" table="projects">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="projid" column="PROJID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="budget">
>>> Index:
>>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (revision
>>> 388908)
>>> +++
>>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (working
>>> copy)
>>> @@ -10,6 +10,11 @@
>>>  <package name="org.apache.jdo.tck.pc.company">
>>>
>>>  <class name="Company" table="companies">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="companyid" column="ID"/>
>>>  <field name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -29,6 +34,11 @@
>>>  </class>
>>>
>>>  <class name="Department" table="departments">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="deptid" column="ID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="company" column="COMPANYID"/>
>>> @@ -144,6 +154,11 @@
>>>  </class>
>>>
>>>  <class name="Project" table="projects">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="projid" column="PROJID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="budget">
>>> @@ -164,6 +179,11 @@
>>>  </class>
>>>
>>>  <interface name="ICompany" table="companies">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="companyid" column="ID"/>
>>>  <property name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -183,6 +203,11 @@
>>>  </interface>
>>>
>>>  <interface name="IDepartment" table="departments">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="deptid" column="ID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="company" column="COMPANYID"/>
>>> @@ -224,8 +249,7 @@
>>>  <foreign-key/>
>>>  </property>
>>>  <property name="reviewedProjects" mapped-by="reviewers">
>>> - </property>
>>> - <property name="projects" mapped-by="members"/>
>>> + </property> <property name="projects"
>>> mapped-by="members"/>
>>>  <property name="team" mapped-by="manager"/>
>>>  <property name="hradvisees" mapped-by="hradvisor"/>
>>>  </interface>
>>> @@ -298,6 +322,11 @@
>>>  </interface>
>>>
>>>  <interface name="IProject" table="projects">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="projid" column="PROJID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="budget">
>>>
>>>
>>>
>>>
>>
>>
>


Re: [Fwd: last issue with completeness test]

Posted by Jörg von Frantzius <jo...@artnology.com>.
Craig Russell schrieb:
> Hi Erik,
>
> It's probably not related to the problem, but why do you declare an
> index defined on the discriminator columns in the metadata?
>   
Yes I'm not Erik but still: in our production system we do that to 
increase performance of queries. We'd even like to have that by default.
> The only other odd thing is the change to projects: <property
> name="projects" mapped-by="members"/>
>
> There's nothing else that I can see that would cause a problem
> deleting instances. Where does the error show up?
>
> Craig
>
> P.S. until Monday, please reply to papajdo@gmail.com in addition to jdo-dev.
>
> On 4/15/06, Michelle Caisse <Mi...@sun.com> wrote:
>   
>>  -------- Original Message --------
>> Subject: last issue with completeness test
>> Date: Sat, 15 Apr 2006 18:51:11 -0700
>> From: Erik Bengtson <er...@jpox.org>
>> Reply-To: jdo-dev@db.apache.org
>> To: jdo-dev@db.apache.org
>>
>>  Hi,
>>
>> JPOX now passes completeness interface test in my local workspace, but
>> apparently the tables are not cleaned out completely on tear down. It passes
>> if
>> it is the only configuration enabled. Can someone take a look on that?
>>
>> Here my changes to the schema and metadata files adding discriminator column
>> to
>> tables.
>>
>> Index:
>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>> ===================================================================
>> ---
>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>> (revision
>> 391636)
>> +++
>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>> (working copy)
>> @@ -130,6 +130,7 @@
>>  STATE CHAR(2),
>>  ZIPCODE CHAR(5),
>>  COUNTRY VARCHAR(64),
>> + DISCRIMINATOR VARCHAR(255),
>>  CONSTRAINT COMPS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>  );
>>
>> @@ -139,6 +140,7 @@
>>  NAME VARCHAR(32) NOT NULL,
>>  EMP_OF_THE_MONTH INTEGER,
>>  COMPANYID INTEGER REFERENCES companies,
>> + DISCRIMINATOR VARCHAR(255),
>>  CONSTRAINT DEPTS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>  );
>>
>> @@ -185,6 +187,7 @@
>>  PROJID INTEGER NOT NULL,
>>  NAME VARCHAR(32) NOT NULL,
>>  BUDGET DECIMAL(11,2) NOT NULL,
>> + DISCRIMINATOR VARCHAR(255),
>>  CONSTRAINT PROJS_UK UNIQUE (PROJID),
>>  CONSTRAINT PROJS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>  );
>> Index:
>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>> ===================================================================
>> ---
>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>> (revision
>> 391636)
>> +++
>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>> (working
>> copy)
>> @@ -182,6 +182,7 @@
>>  STATE CHAR(2),
>>  ZIPCODE CHAR(5),
>>  COUNTRY VARCHAR(64),
>> + DISCRIMINATOR VARCHAR(255),
>>  CONSTRAINT COMPS_PK PRIMARY KEY (ID)
>>  );
>>
>> @@ -190,6 +191,7 @@
>>  NAME VARCHAR(32) NOT NULL,
>>  EMP_OF_THE_MONTH INTEGER,
>>  COMPANYID INTEGER REFERENCES companies,
>> + DISCRIMINATOR VARCHAR(255),
>>  CONSTRAINT DEPTS_PK PRIMARY KEY (ID)
>>  );
>>
>> @@ -232,6 +234,7 @@
>>  PROJID INTEGER NOT NULL,
>>  NAME VARCHAR(32) NOT NULL,
>>  BUDGET DECIMAL(11,2) NOT NULL,
>> + DISCRIMINATOR VARCHAR(255),
>>  CONSTRAINT PROJS_PK PRIMARY KEY (PROJID)
>>  );
>>
>> Index:
>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
>> ===================================================================
>> ---
>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
>> (revision
>> 388908)
>> +++
>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
>> (working
>> copy)
>> @@ -11,6 +11,11 @@
>>
>>  <class name="Company" table="companies">
>>  <datastore-identity strategy="identity"
>> column="DATASTORE_IDENTITY"/>
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <field name="companyid" column="ID"/>
>>  <field name="name" column="NAME">
>>  <column name="NAME" sql-type="VARCHAR"/>
>> @@ -43,6 +48,11 @@
>>
>>  <class name="Department" table="departments">
>>  <datastore-identity strategy="identity"
>> column="DATASTORE_IDENTITY"/>
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <field name="deptid" column="ID"/>
>>  <field name="name" column="NAME"/>
>>  <field name="company" column="COMPANYID"/>
>> @@ -149,6 +159,11 @@
>>
>>  <class name="Project" table="projects">
>>  <datastore-identity strategy="identity"
>> column="DATASTORE_IDENTITY"/>
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <field name="projid" column="PROJID"/>
>>  <field name="name" column="NAME"/>
>>  <field name="budget">
>> @@ -168,6 +183,11 @@
>>
>>  <interface name="ICompany" table="companies">
>>  <datastore-identity strategy="identity"
>> column="DATASTORE_IDENTITY"/>
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <property name="companyid" column="ID"/>
>>  <property name="name" column="NAME">
>>  <column name="NAME" sql-type="VARCHAR"/>
>> @@ -188,6 +208,11 @@
>>
>>  <interface name="IDepartment" table="departments">
>>  <datastore-identity strategy="identity"
>> column="DATASTORE_IDENTITY"/>
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <property name="deptid" column="ID"/>
>>  <property name="name" column="NAME"/>
>>  <property name="company" column="COMPANYID"/>
>> @@ -306,6 +331,11 @@
>>
>>  <interface name="IProject" table="projects">
>>  <datastore-identity strategy="identity"
>> column="DATASTORE_IDENTITY"/>
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <property name="projid" column="PROJID"/>
>>  <property name="name" column="NAME"/>
>>  <property name="budget">
>> Index:
>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
>> ===================================================================
>> ---
>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
>> (revision
>> 388908)
>> +++
>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
>> (working
>> copy)
>> @@ -10,6 +10,11 @@
>>  <package name="org.apache.jdo.tck.pc.company">
>>
>>  <class name="Company" table="companies">
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <field name="companyid" column="ID"/>
>>  <field name="name" column="NAME">
>>  <column name="NAME" sql-type="VARCHAR"/>
>> @@ -29,6 +34,11 @@
>>  </class>
>>
>>  <class name="Department" table="departments">
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <field name="deptid" column="ID"/>
>>  <field name="name" column="NAME"/>
>>  <field name="company" column="COMPANYID"/>
>> @@ -144,6 +154,11 @@
>>  </class>
>>
>>  <class name="Project" table="projects">
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <field name="projid" column="PROJID"/>
>>  <field name="name" column="NAME"/>
>>  <field name="budget">
>> @@ -164,6 +179,11 @@
>>  </class>
>>
>>  <interface name="ICompany" table="companies">
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <property name="companyid" column="ID"/>
>>  <property name="name" column="NAME">
>>  <column name="NAME" sql-type="VARCHAR"/>
>> @@ -183,6 +203,11 @@
>>  </interface>
>>
>>  <interface name="IDepartment" table="departments">
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <property name="deptid" column="ID"/>
>>  <property name="name" column="NAME"/>
>>  <property name="company" column="COMPANYID"/>
>> @@ -224,8 +249,7 @@
>>  <foreign-key/>
>>  </property>
>>  <property name="reviewedProjects" mapped-by="reviewers">
>> - </property>
>> - <property name="projects" mapped-by="members"/>
>> + </property> <property name="projects"
>> mapped-by="members"/>
>>  <property name="team" mapped-by="manager"/>
>>  <property name="hradvisees" mapped-by="hradvisor"/>
>>  </interface>
>> @@ -298,6 +322,11 @@
>>  </interface>
>>
>>  <interface name="IProject" table="projects">
>> + <inheritance strategy="new-table">
>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>> + </discriminator>
>> + </inheritance>
>>  <property name="projid" column="PROJID"/>
>>  <property name="name" column="NAME"/>
>>  <property name="budget">
>>
>>
>>
>>     
>
>
>