My advice is stick with single-table mappings -- horizontal mappings don't work as they should. Some of this is documented in the release notes:

http://developer.apple.com/documentation/WebObjects/ReleaseNotes/ ErteRelNotes/chapter_1_section_8.html

Note that I filed that bug *years* ago at NeXT, so don't hold your breath for a fix!

Cheers,
Neale.

On 9 Feb 2006, at 16:39, Kieran Kelleher wrote:

Is this a bug or am I doing something wrong? .....

I am fetching instances of entity CTProduct qualified as follows:

public NSArray productsWithPendingMessages ( EOEditingContext ec ) { EOQualifier qualifier = new EOKeyValueQualifier ( "mediaTemplates.messages.workflowState", EOQualifier.QualifierOperatorEqual, CTMessage.WORKFLOW_STATE_READY_TO_BE_SENT ); EOFetchSpecification fs = new EOFetchSpecification ( "CTProduct", qualifier,
                                                                null,
                                                                true,
                                                                false,
null ); NSArray foundProducts = ec.objectsWithFetchSpecification ( fs ); if ( log.isDebugEnabled() ) log.debug("foundProducts count = " + foundProducts.count() );
            return foundProducts;
        }

Relationships
CTProduct <-->> CTMediaTemplate <-->> CTMessage

workflowState is just a text field

CTMessage is an abstract class and subclasses are using horizontal table mapping for inheritance via separate tables. Therefore CTMessage does not have a table in the EOModel definition, so the SQL incorrectly generates a null for the table name. Is it a case of this being too complex for EOF?

Incidentally CTMediaTemplate is also abstract, but I use single table mapping for its subclasses.

The relevant error is:
com.webobjects.jdbcadaptor.JDBCAdaptorException: EvaluateExpression failed: <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT DISTINCT t0.defaultprice, t0.descriptor, t0.itemid, t0.longdescriptor, t0.oid, t0.oidimage, t0.oidmailingrate, t0.oidoutputmedia, t0.printingcost, t0.recaddtime, t0.recadduser, t0.recmodtime, t0.recmoduser, t0.technotes FROM product t0, null T2, mediatemplate T1 WHERE T2.workflowstate = ? AND T1.oid = T2.oidmediatemplate AND t0.oid = T1.oidproduct" withBindings: 1:"rtbs"(workflowState)>: Next exception:SQL State:42000 -- error code: 1064 -- msg: Syntax error or access violation message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'null T2, mediatemplate [2006-02-09 11:17:48 EST]

Should I just accept that horizontal inheritance table mapping will kill this kind of a sql generation for a qualifier ...... or just switch to single table mapping which I guess will solve the problem?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/neale.patton% 40bbc.co.uk

This email sent to [EMAIL PROTECTED]


http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. Further communication will signify your consent to this.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to