You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Julia Filho <jf...@yahoo.com> on 2010/08/25 18:10:22 UTC

Re: Vertical inheritance

Hi,

Is vertical inheritance not supported in Cayenne 3.0?  According to the
documentation, vertical inheritance is supported, but I am running into
problems with the generated SELECT query when reading one of the subclasses:

The generated query is:

SELECT t0.DATA_COLLECTION_ID, t0.COLLECTION_TYPE_ID, t0.DATA_COLLECTION_ID,
t0.SCHOOL_YEAR, t0.SNAPSHOT_DATE FROM ESDM.K12_DATA_COLLECTION t0 JOIN
ESDM.DATA_COLLECTION t1 ON (t0.DATA_COLLECTION_ID = t1.DATA_COLLECTION_ID)
JOIN ESDM.DATA_COLLECTION_TYPE t2 ON (t1.COLLECTION_TYPE_ID =
t2.COLLECTION_TYPE_ID) WHERE t2.COLLECTION_TYPE_ID = ? [bind:
1->COLLECTION_TYPE_ID:3]


which is a problem because 
1) column COLLECTION_TYPE_ID is in select list for the subclass
(K12_DATA_COLLECTION) but that column is in the super class table
(DATA_COLLECTION), not the subclass 
2) DATA_COLLECTION_ID is in the K12_DATA_COLLECTION select list twice.

Do you have any suggestions, or is this functionality not yet supported?

thank you for any assistance you can give
Julie


-- 
View this message in context: http://cayenne.195.n3.nabble.com/Vertical-inheritance-tp827636p1334340.html
Sent from the Cayenne - Dev mailing list archive at Nabble.com.

Re: Vertical inheritance

Posted by Julia Filho <jf...@yahoo.com>.
Hi Andrus,

Thanks for your help on this.  We have decided, though, to use single
inheritance in this situation due to 
performance concerns (want to minimize joins). 

If we do use vertical inheritance in the future, I will let you know of
anything interesting (or challenging) we find.

thanks again,
Julie Filho
-- 
View this message in context: http://cayenne.195.n3.nabble.com/Vertical-inheritance-tp827636p1372064.html
Sent from the Cayenne - Dev mailing list archive at Nabble.com.

Re: Vertical inheritance

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Julia,

With a bit of tweaking of the model I was able to get a query like that:

SELECT t0.LAST_MODIFIED_TIME, t0.COLLECTION_TYPE_ID, t0.AUTO_OPEN_DATE, t0.SNAPSHOT_DATE, t0.DESCRIPTION, t0.SUPT_APPROVAL_REQD, t0.LAST_MODIFIED_BY, t0.ACTIVE_IND, t0.AUTO_CLOSE_DATE, t0.COLLECTION_NAME, t1.SCHOOL_YEAR, t0.DATA_COLLECTION_ID FROM ESDM.DATA_COLLECTION t0 LEFT JOIN ESDM.K12_DATA_COLLECTION t1 ON (t0.DATA_COLLECTION_ID = t1.DATA_COLLECTION_ID) WHERE t0.COLLECTION_TYPE_ID = ? [bind: 1->COLLECTION_TYPE_ID:3] 

A few things that I changed:

* Removed explicit "Table" mapping from subclass. I.e.

<obj-entity name="K12DataCollection" className="com.escholar.datamgr.model.K12DataCollection" dbEntityName="K12_DATA_COLLECTION">

Should be

<obj-entity name="K12DataCollection" className="com.escholar.datamgr.model.K12DataCollection">

Even though the table is the same as superclass, it seemed to confuse Cayenne. I will open a Jira to add a validation check for this condition.

* There was a warning in your DataMap about DataCollection.k12DataCollection ObjRelationship. So I removed it as it is uneeded. (DbRelationship should stay though).

Let me know if you have further questions. Vertical inheritance is a fairly recent addition to Cayenne, so we may not catch/handle all deviations from the standard mapping. You feedback is very helpful in this regard.

Cheers,
Andrus

On Aug 25, 2010, at 7:10 PM, Julia Filho wrote:

> 
> Hi,
> 
> Is vertical inheritance not supported in Cayenne 3.0?  According to the
> documentation, vertical inheritance is supported, but I am running into
> problems with the generated SELECT query when reading one of the subclasses:
> 
> The generated query is:
> 
> SELECT t0.DATA_COLLECTION_ID, t0.COLLECTION_TYPE_ID, t0.DATA_COLLECTION_ID,
> t0.SCHOOL_YEAR, t0.SNAPSHOT_DATE FROM ESDM.K12_DATA_COLLECTION t0 JOIN
> ESDM.DATA_COLLECTION t1 ON (t0.DATA_COLLECTION_ID = t1.DATA_COLLECTION_ID)
> JOIN ESDM.DATA_COLLECTION_TYPE t2 ON (t1.COLLECTION_TYPE_ID =
> t2.COLLECTION_TYPE_ID) WHERE t2.COLLECTION_TYPE_ID = ? [bind:
> 1->COLLECTION_TYPE_ID:3]
> 
> 
> which is a problem because 
> 1) column COLLECTION_TYPE_ID is in select list for the subclass
> (K12_DATA_COLLECTION) but that column is in the super class table
> (DATA_COLLECTION), not the subclass 
> 2) DATA_COLLECTION_ID is in the K12_DATA_COLLECTION select list twice.
> 
> Do you have any suggestions, or is this functionality not yet supported?
> 
> thank you for any assistance you can give
> Julie
> 
> 
> -- 
> View this message in context: http://cayenne.195.n3.nabble.com/Vertical-inheritance-tp827636p1334340.html
> Sent from the Cayenne - Dev mailing list archive at Nabble.com.
> 


Re: Vertical inheritance

Posted by Julia Filho <jf...@yahoo.com>.
One thing to note (and this is the kind of thing that happens when you start
trying alot of things to get something to work) is that the DATA_COLLECTION
table now has the attributes that I want to have in the K12_DATA_COLLECTION
because I am in the process of trying Single Table inheritance, and the
mapping is part way there.  The fact is, though, that the generated SELECT
query is the same in that it is referencing COLLECTION_TYPE_ID in
K12_DATA_COLLECTION.

again - thanks for your help and sorry for the barrage of posts
Julie



Julia Filho wrote:
> 
> Hi,
> 
> Please disregard my previous post - those mappings were from the wrong
> mapping file. These are the mappings I am using:
> 
> 	<db-entity name="DATA_COLLECTION" schema="ESDM">
> 		<db-attribute name="ACTIVE_IND" type="CHAR" isMandatory="true"
> length="1"/>
> 		<db-attribute name="AUTO_CLOSE_DATE" type="TIMESTAMP" length="7"/>
> 		<db-attribute name="AUTO_OPEN_DATE" type="TIMESTAMP" length="7"/>
> 		<db-attribute name="COLLECTION_NAME" type="VARCHAR" isMandatory="true"
> length="255"/>
> 		<db-attribute name="COLLECTION_TYPE_ID" type="INTEGER"
> isMandatory="true" length="22"/>
> 		<db-attribute name="DATA_COLLECTION_ID" type="INTEGER"
> isPrimaryKey="true" isMandatory="true" length="22"/>
> 		<db-attribute name="DESCRIPTION" type="VARCHAR" isMandatory="true"
> length="255"/>
> 		<db-attribute name="LAST_MODIFIED_BY" type="VARCHAR" isMandatory="true"
> length="20"/>
> 		<db-attribute name="LAST_MODIFIED_TIME" type="TIMESTAMP"
> isMandatory="true" length="11"/>
> 		<db-attribute name="SCHOOL_YEAR" type="TIMESTAMP" length="7"/>
> 		<db-attribute name="SNAPSHOT_DATE" type="TIMESTAMP" length="7"/>
> 		<db-attribute name="SUPT_APPROVAL_REQD" type="CHAR" isMandatory="true"
> length="1"/>
> 	</db-entity>
> 
> 
> 	<db-entity name="K12_DATA_COLLECTION" schema="ESDM">
> 		<db-attribute name="DATA_COLLECTION_ID" type="INTEGER"
> isPrimaryKey="true" isMandatory="true" length="22"/>
> 		<db-attribute name="SCHOOL_YEAR" type="TIMESTAMP" isMandatory="true"
> length="7"/>
> 		<db-attribute name="SNAPSHOT_DATE" type="TIMESTAMP" isMandatory="true"
> length="7"/>
> 	</db-entity>
> 
> 	<db-entity name="DATA_COLLECTION_TYPE" schema="ESDM">
> 		<db-attribute name="COLLECTION_TYPE_DESC" type="VARCHAR" length="255"/>
> 		<db-attribute name="COLLECTION_TYPE_ID" type="INTEGER"
> isPrimaryKey="true" isMandatory="true" length="22"/>
> 		<db-attribute name="COLLECTION_TYPE_NAME" type="VARCHAR"
> isMandatory="true" length="20"/>
> 	</db-entity>
> 
> 
> 
> 	<obj-entity name="DataCollection"
> className="com.escholar.datamgr.model.DataCollection"
> dbEntityName="DATA_COLLECTION">
> 		<obj-attribute name="activeInd" type="java.lang.String"
> db-attribute-path="ACTIVE_IND"/>
> 		<obj-attribute name="autoCloseDate" type="java.util.Date"
> db-attribute-path="AUTO_CLOSE_DATE"/>
> 		<obj-attribute name="autoOpenDate" type="java.util.Date"
> db-attribute-path="AUTO_OPEN_DATE"/>
> 		<obj-attribute name="collectionName" type="java.lang.String"
> db-attribute-path="COLLECTION_NAME"/>
> 		<obj-attribute name="description" type="java.lang.String"
> db-attribute-path="DESCRIPTION"/>
> 		<obj-attribute name="lastModifiedBy" type="java.lang.String"
> db-attribute-path="LAST_MODIFIED_BY"/>
> 		<obj-attribute name="lastModifiedTime" type="java.util.Date"
> db-attribute-path="LAST_MODIFIED_TIME"/>
> 		<obj-attribute name="schoolYear" type="java.util.Date"
> db-attribute-path="SCHOOL_YEAR"/>
> 		<obj-attribute name="snapshotDate" type="java.util.Date"
> db-attribute-path="SNAPSHOT_DATE"/>
> 		<obj-attribute name="suptApprovalReqd" type="java.lang.String"
> db-attribute-path="SUPT_APPROVAL_REQD"/>
> 	</obj-entity>
> 	<obj-entity name="K12DataCollection" superEntityName="DataCollection"
> className="com.escholar.datamgr.model.K12DataCollection"
> dbEntityName="DATA_COLLECTION">
> 		<qualifier><![CDATA[collectionTypeId = 3]]></qualifier>
> 		<obj-attribute name="schoolYear" type="java.util.Date"
> db-attribute-path="SCHOOL_YEAR"/>
> 		<obj-attribute name="snapshotDate" type="java.util.Date"
> db-attribute-path="SNAPSHOT_DATE"/>
> 	</obj-entity>
> 
> 	<obj-entity name="DataCollectionType"
> className="com.escholar.datamgr.model.DataCollectionType"
> dbEntityName="DATA_COLLECTION_TYPE">
> 		<obj-attribute name="collectionTypeDesc" type="java.lang.String"
> db-attribute-path="COLLECTION_TYPE_DESC"/>
> 		<obj-attribute name="collectionTypeId" type="java.lang.Integer"
> db-attribute-path="COLLECTION_TYPE_ID"/>
> 		<obj-attribute name="collectionTypeName" type="java.lang.String"
> db-attribute-path="COLLECTION_TYPE_NAME"/>
> 	</obj-entity>
> 
> 
> 	<db-relationship name="k12DataCollection" source="DATA_COLLECTION"
> target="K12_DATA_COLLECTION" toDependentPK="true" toMany="false">
> 		<db-attribute-pair source="DATA_COLLECTION_ID"
> target="DATA_COLLECTION_ID"/>
> 	</db-relationship>
> 
> 	<db-relationship name="dataCollection" source="K12_DATA_COLLECTION"
> target="DATA_COLLECTION" toMany="false">
> 		<db-attribute-pair source="DATA_COLLECTION_ID"
> target="DATA_COLLECTION_ID"/>
> 	</db-relationship>
> 
> 	<db-relationship name="collectionType" source="DATA_COLLECTION"
> target="DATA_COLLECTION_TYPE" toMany="false">
> 		<db-attribute-pair source="COLLECTION_TYPE_ID"
> target="COLLECTION_TYPE_ID"/>
> 	</db-relationship>
> 
> 	<db-relationship name="dataCollections" source="DATA_COLLECTION_TYPE"
> target="DATA_COLLECTION" toMany="true">
> 		<db-attribute-pair source="COLLECTION_TYPE_ID"
> target="COLLECTION_TYPE_ID"/>
> 	</db-relationship>
> 
> 
> 	<obj-relationship name="collectionType" source="DataCollection"
> target="DataCollectionType" deleteRule="Nullify"
> db-relationship-path="collectionType"/>
> 
> 	<obj-relationship name="k12DataCollection" source="DataCollection"
> target="K12DataCollection" deleteRule="Nullify"
> db-relationship-path="k12DataCollection"/>
> 
> 	<obj-relationship name="dataCollections" source="DataCollectionType"
> target="DataCollection" deleteRule="Deny"
> db-relationship-path="dataCollections"/>
> 
> 
> I apologize for the confusion.
> 
> thanks again,
> Julie
> 
> 
> 
> 	<db-relationship name="dataCollections" source="DATA_COLLECTION_TYPE"
> target="DATA_COLLECTION" toMany="true">
> 		<db-attribute-pair source="COLLECTION_TYPE_ID"
> target="COLLECTION_TYPE_ID"/>
> 	</db-relationship>
> 

-- 
View this message in context: http://cayenne.195.n3.nabble.com/Vertical-inheritance-tp827636p1353524.html
Sent from the Cayenne - Dev mailing list archive at Nabble.com.

Re: Vertical inheritance

Posted by Julia Filho <jf...@yahoo.com>.
Hi,

Please disregard my previous post - those mappings were from the wrong
mapping file. These are the mappings I am using:

	<db-entity name="DATA_COLLECTION" schema="ESDM">
		<db-attribute name="ACTIVE_IND" type="CHAR" isMandatory="true"
length="1"/>
		<db-attribute name="AUTO_CLOSE_DATE" type="TIMESTAMP" length="7"/>
		<db-attribute name="AUTO_OPEN_DATE" type="TIMESTAMP" length="7"/>
		<db-attribute name="COLLECTION_NAME" type="VARCHAR" isMandatory="true"
length="255"/>
		<db-attribute name="COLLECTION_TYPE_ID" type="INTEGER" isMandatory="true"
length="22"/>
		<db-attribute name="DATA_COLLECTION_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="22"/>
		<db-attribute name="DESCRIPTION" type="VARCHAR" isMandatory="true"
length="255"/>
		<db-attribute name="LAST_MODIFIED_BY" type="VARCHAR" isMandatory="true"
length="20"/>
		<db-attribute name="LAST_MODIFIED_TIME" type="TIMESTAMP"
isMandatory="true" length="11"/>
		<db-attribute name="SCHOOL_YEAR" type="TIMESTAMP" length="7"/>
		<db-attribute name="SNAPSHOT_DATE" type="TIMESTAMP" length="7"/>
		<db-attribute name="SUPT_APPROVAL_REQD" type="CHAR" isMandatory="true"
length="1"/>
	</db-entity>


	<db-entity name="K12_DATA_COLLECTION" schema="ESDM">
		<db-attribute name="DATA_COLLECTION_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="22"/>
		<db-attribute name="SCHOOL_YEAR" type="TIMESTAMP" isMandatory="true"
length="7"/>
		<db-attribute name="SNAPSHOT_DATE" type="TIMESTAMP" isMandatory="true"
length="7"/>
	</db-entity>

	<db-entity name="DATA_COLLECTION_TYPE" schema="ESDM">
		<db-attribute name="COLLECTION_TYPE_DESC" type="VARCHAR" length="255"/>
		<db-attribute name="COLLECTION_TYPE_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="22"/>
		<db-attribute name="COLLECTION_TYPE_NAME" type="VARCHAR"
isMandatory="true" length="20"/>
	</db-entity>



	<obj-entity name="DataCollection"
className="com.escholar.datamgr.model.DataCollection"
dbEntityName="DATA_COLLECTION">
		<obj-attribute name="activeInd" type="java.lang.String"
db-attribute-path="ACTIVE_IND"/>
		<obj-attribute name="autoCloseDate" type="java.util.Date"
db-attribute-path="AUTO_CLOSE_DATE"/>
		<obj-attribute name="autoOpenDate" type="java.util.Date"
db-attribute-path="AUTO_OPEN_DATE"/>
		<obj-attribute name="collectionName" type="java.lang.String"
db-attribute-path="COLLECTION_NAME"/>
		<obj-attribute name="description" type="java.lang.String"
db-attribute-path="DESCRIPTION"/>
		<obj-attribute name="lastModifiedBy" type="java.lang.String"
db-attribute-path="LAST_MODIFIED_BY"/>
		<obj-attribute name="lastModifiedTime" type="java.util.Date"
db-attribute-path="LAST_MODIFIED_TIME"/>
		<obj-attribute name="schoolYear" type="java.util.Date"
db-attribute-path="SCHOOL_YEAR"/>
		<obj-attribute name="snapshotDate" type="java.util.Date"
db-attribute-path="SNAPSHOT_DATE"/>
		<obj-attribute name="suptApprovalReqd" type="java.lang.String"
db-attribute-path="SUPT_APPROVAL_REQD"/>
	</obj-entity>
	<obj-entity name="K12DataCollection" superEntityName="DataCollection"
className="com.escholar.datamgr.model.K12DataCollection"
dbEntityName="DATA_COLLECTION">
		<qualifier><![CDATA[collectionTypeId = 3]]></qualifier>
		<obj-attribute name="schoolYear" type="java.util.Date"
db-attribute-path="SCHOOL_YEAR"/>
		<obj-attribute name="snapshotDate" type="java.util.Date"
db-attribute-path="SNAPSHOT_DATE"/>
	</obj-entity>

	<obj-entity name="DataCollectionType"
className="com.escholar.datamgr.model.DataCollectionType"
dbEntityName="DATA_COLLECTION_TYPE">
		<obj-attribute name="collectionTypeDesc" type="java.lang.String"
db-attribute-path="COLLECTION_TYPE_DESC"/>
		<obj-attribute name="collectionTypeId" type="java.lang.Integer"
db-attribute-path="COLLECTION_TYPE_ID"/>
		<obj-attribute name="collectionTypeName" type="java.lang.String"
db-attribute-path="COLLECTION_TYPE_NAME"/>
	</obj-entity>


	<db-relationship name="k12DataCollection" source="DATA_COLLECTION"
target="K12_DATA_COLLECTION" toDependentPK="true" toMany="false">
		<db-attribute-pair source="DATA_COLLECTION_ID"
target="DATA_COLLECTION_ID"/>
	</db-relationship>

	<db-relationship name="dataCollection" source="K12_DATA_COLLECTION"
target="DATA_COLLECTION" toMany="false">
		<db-attribute-pair source="DATA_COLLECTION_ID"
target="DATA_COLLECTION_ID"/>
	</db-relationship>

	<db-relationship name="collectionType" source="DATA_COLLECTION"
target="DATA_COLLECTION_TYPE" toMany="false">
		<db-attribute-pair source="COLLECTION_TYPE_ID"
target="COLLECTION_TYPE_ID"/>
	</db-relationship>

	<db-relationship name="dataCollections" source="DATA_COLLECTION_TYPE"
target="DATA_COLLECTION" toMany="true">
		<db-attribute-pair source="COLLECTION_TYPE_ID"
target="COLLECTION_TYPE_ID"/>
	</db-relationship>


	<obj-relationship name="collectionType" source="DataCollection"
target="DataCollectionType" deleteRule="Nullify"
db-relationship-path="collectionType"/>

	<obj-relationship name="k12DataCollection" source="DataCollection"
target="K12DataCollection" deleteRule="Nullify"
db-relationship-path="k12DataCollection"/>

	<obj-relationship name="dataCollections" source="DataCollectionType"
target="DataCollection" deleteRule="Deny"
db-relationship-path="dataCollections"/>


I apologize for the confusion.

thanks again,
Julie



	<db-relationship name="dataCollections" source="DATA_COLLECTION_TYPE"
target="DATA_COLLECTION" toMany="true">
		<db-attribute-pair source="COLLECTION_TYPE_ID"
target="COLLECTION_TYPE_ID"/>
	</db-relationship>
-- 
View this message in context: http://cayenne.195.n3.nabble.com/Vertical-inheritance-tp827636p1352997.html
Sent from the Cayenne - Dev mailing list archive at Nabble.com.

Re: Vertical inheritance

Posted by Julia Filho <jf...@yahoo.com>.
Hi,

Relevant mapping sections are:

	<db-entity name="DATA_COLLECTION" schema="ESDM">
		<db-attribute name="ACTIVE_IND" type="CHAR" isMandatory="true"
length="1"/>
		<db-attribute name="AUTO_CLOSE_DATE" type="TIMESTAMP" length="7"/>
		<db-attribute name="AUTO_OPEN_DATE" type="TIMESTAMP" length="7"/>
		<db-attribute name="COLLECTION_NAME" type="VARCHAR" isMandatory="true"
length="255"/>
		<db-attribute name="COLLECTION_TYPE_ID" type="INTEGER" isMandatory="true"
length="22"/>
		<db-attribute name="DATA_COLLECTION_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="22"/>
		<db-attribute name="DESCRIPTION" type="VARCHAR" isMandatory="true"
length="255"/>
		<db-attribute name="LAST_MODIFIED_BY" type="VARCHAR" isMandatory="true"
length="20"/>
		<db-attribute name="LAST_MODIFIED_TIME" type="TIMESTAMP"
isMandatory="true" length="11"/>
		<db-attribute name="SUPT_APPROVAL_REQD" type="CHAR" isMandatory="true"
length="1"/>
	</db-entity>

	</db-entity>
	<db-entity name="K12_DATA_COLLECTION" schema="ESDM">
		<db-attribute name="DATA_COLLECTION_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="22"/>
		<db-attribute name="SCHOOL_YEAR" type="TIMESTAMP" isMandatory="true"
length="7"/>
		<db-attribute name="SNAPSHOT_DATE" type="TIMESTAMP" isMandatory="true"
length="7"/>
	</db-entity>

	<db-entity name="DATA_COLLECTION_TYPE" schema="ESDM">
		<db-attribute name="COLLECTION_TYPE_DESC" type="VARCHAR" length="255"/>
		<db-attribute name="COLLECTION_TYPE_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="22"/>
		<db-attribute name="COLLECTION_TYPE_NAME" type="VARCHAR"
isMandatory="true" length="20"/>
	</db-entity>


	<obj-entity name="DataCollection"
className="com.escholar.datamgr.model.DataCollection"
dbEntityName="DATA_COLLECTION">
		<obj-attribute name="activeInd" type="java.lang.String"
db-attribute-path="ACTIVE_IND"/>
		<obj-attribute name="autoCloseDate" type="java.util.Date"
db-attribute-path="AUTO_CLOSE_DATE"/>
		<obj-attribute name="autoOpenDate" type="java.util.Date"
db-attribute-path="AUTO_OPEN_DATE"/>
		<obj-attribute name="collectionName" type="java.lang.String"
db-attribute-path="COLLECTION_NAME"/>
		<obj-attribute name="dataCollectionId" type="java.lang.Integer"
db-attribute-path="DATA_COLLECTION_ID"/>
		<obj-attribute name="description" type="java.lang.String"
db-attribute-path="DESCRIPTION"/>
		<obj-attribute name="lastModifiedBy" type="java.lang.String"
db-attribute-path="LAST_MODIFIED_BY"/>
		<obj-attribute name="lastModifiedTime" type="java.util.Date"
db-attribute-path="LAST_MODIFIED_TIME"/>
		<obj-attribute name="suptApprovalReqd" type="java.lang.String"
db-attribute-path="SUPT_APPROVAL_REQD"/>
	</obj-entity>


	<obj-entity name="K12DataCollection"
className="com.escholar.datamgr.model.K12DataCollection"
dbEntityName="K12_DATA_COLLECTION">
		<obj-attribute name="dataCollectionId" type="java.lang.Integer"
db-attribute-path="DATA_COLLECTION_ID"/>
		<obj-attribute name="schoolYear" type="java.util.Date"
db-attribute-path="SCHOOL_YEAR"/>
		<obj-attribute name="snapshotDate" type="java.util.Date"
db-attribute-path="SNAPSHOT_DATE"/>
	</obj-entity>

	<obj-entity name="DataCollectionType"
className="com.escholar.datamgr.model.DataCollectionType"
dbEntityName="DATA_COLLECTION_TYPE">
		<obj-attribute name="collectionTypeDesc" type="java.lang.String"
db-attribute-path="COLLECTION_TYPE_DESC"/>
		<obj-attribute name="collectionTypeId" type="java.lang.Integer"
db-attribute-path="COLLECTION_TYPE_ID"/>
		<obj-attribute name="collectionTypeName" type="java.lang.String"
db-attribute-path="COLLECTION_TYPE_NAME"/>
	</obj-entity>

	<db-relationship name="k12DataCollection" source="DATA_COLLECTION"
target="K12_DATA_COLLECTION" toDependentPK="true" toMany="false">
		<db-attribute-pair source="DATA_COLLECTION_ID"
target="DATA_COLLECTION_ID"/>
	</db-relationship>

	<db-relationship name="dataCollection" source="K12_DATA_COLLECTION"
target="DATA_COLLECTION" toMany="false">
		<db-attribute-pair source="DATA_COLLECTION_ID"
target="DATA_COLLECTION_ID"/>
	</db-relationship>

	<db-relationship name="collectionType" source="DATA_COLLECTION"
target="DATA_COLLECTION_TYPE" toMany="false">
		<db-attribute-pair source="COLLECTION_TYPE_ID"
target="COLLECTION_TYPE_ID"/>
	</db-relationship>

	<db-relationship name="dataCollections" source="DATA_COLLECTION_TYPE"
target="DATA_COLLECTION" toMany="true">
		<db-attribute-pair source="COLLECTION_TYPE_ID"
target="COLLECTION_TYPE_ID"/>
	</db-relationship>

	<obj-relationship name="collectionType" source="DataCollection"
target="DataCollectionType" deleteRule="Nullify"
db-relationship-path="collectionType"/>

<obj-relationship name="k12DataCollection" source="DataCollection"
target="K12DataCollection" deleteRule="Nullify"
db-relationship-path="dataCollection"/>


(I thing that's it)

ANother thing to note is that the superclass, DataCollection is not abstract
- not sure if that matters or not.

thank you very much for your help!
Julie Filho

-- 
View this message in context: http://cayenne.195.n3.nabble.com/Vertical-inheritance-tp827636p1352592.html
Sent from the Cayenne - Dev mailing list archive at Nabble.com.

Re: Vertical inheritance

Posted by Robert Zeigler <ro...@roxanemy.com>.
Providing the relevant portions of the mapping file would be a good place to start. :)

Robert

On Aug 25, 2010, at 8/2511:10 AM , Julia Filho wrote:

> 
> Hi,
> 
> Is vertical inheritance not supported in Cayenne 3.0?  According to the
> documentation, vertical inheritance is supported, but I am running into
> problems with the generated SELECT query when reading one of the subclasses:
> 
> The generated query is:
> 
> SELECT t0.DATA_COLLECTION_ID, t0.COLLECTION_TYPE_ID, t0.DATA_COLLECTION_ID,
> t0.SCHOOL_YEAR, t0.SNAPSHOT_DATE FROM ESDM.K12_DATA_COLLECTION t0 JOIN
> ESDM.DATA_COLLECTION t1 ON (t0.DATA_COLLECTION_ID = t1.DATA_COLLECTION_ID)
> JOIN ESDM.DATA_COLLECTION_TYPE t2 ON (t1.COLLECTION_TYPE_ID =
> t2.COLLECTION_TYPE_ID) WHERE t2.COLLECTION_TYPE_ID = ? [bind:
> 1->COLLECTION_TYPE_ID:3]
> 
> 
> which is a problem because 
> 1) column COLLECTION_TYPE_ID is in select list for the subclass
> (K12_DATA_COLLECTION) but that column is in the super class table
> (DATA_COLLECTION), not the subclass 
> 2) DATA_COLLECTION_ID is in the K12_DATA_COLLECTION select list twice.
> 
> Do you have any suggestions, or is this functionality not yet supported?
> 
> thank you for any assistance you can give
> Julie
> 
> 
> -- 
> View this message in context: http://cayenne.195.n3.nabble.com/Vertical-inheritance-tp827636p1334340.html
> Sent from the Cayenne - Dev mailing list archive at Nabble.com.