[OS-JIRA] Created: (WOL-443) Entity Modeler: missing validation for should-be inherited non-class members.

From: Lachlan Deck (JIRA) ("Lachlan)
Date: Sun May 20 2007 - 01:30:48 EDT

  • Next message: Mike Schrag (JIRA): "[OS-JIRA] Created: (WOL-444) "no" keypath abruptly stops completing because it matches the boolean "no" binding"

    Entity Modeler: missing validation for should-be inherited non-class members.
    -----------------------------------------------------------------------------

                     Key: WOL-443
                     URL: http://issues.objectstyle.org/jira/browse/WOL-443
                 Project: WOProject/WOLips
              Issue Type: Bug
              Components: wolips
        Affects Versions: 2.0.0.* (unreleased please specify)
             Environment: 2.0.0.4021
                Reporter: Lachlan Deck

    I've just experimented with creating a simple, but conceptually identical, model in both EOModeler and then in Entity Modeler and running them both in a D2W app against the same database. The one from Entity Modeler fails at runtime when attempting to create the relationship to a Company because it doesn't automatically create derived attributes for non-class attributes such as foreign keys - but yet Entity Modeler doesn't show any validation warnings after subclassing an entity (choosing vertical inheritance).

    Here's the way the model should be when creating the entities:
    Company (id, name)
     ^
     |
     -->> Person (companyId, firstName, id, lastName)
          Employee(/companyId/, /firstName/, id, /lastName/, salary)
          Customer(/companyId/, /firstName/, id, /lastName/, phoneNumber)

    When creating the sub-entities of Person in Entity Modeler, the companyId is not created in Entity Modeler. Doing so by hand works fine, but it's easy to miss in a larger project because there's no validation for such attributes.

    Exception at runtime:
    java.lang.IllegalStateException: sqlStringForKeyValueQualifier: attempt to generate SQL for com.webobjects.eocontrol.EOKeyValueQualifier (companyId = 1) failed because attribute identified by key 'companyId' was not reachable from from entity 'Customer'.

    Adding the missing flattened foreign key fixes the problem.

    But then, furthering the example, I recreated the models utilising a Prototypes framework of mine. Now at runtime the Entity Modeler version fails to create an Employee record. The error message (in the D2W app on screen) reads: "Could not save your changes: Object value '1' for column 3 is not an instanceof String."

    After rebuilding the model (within Entity Modeler) a further time after upgrading WOLips again it now works. But I have no idea why - and this concerns me. i.e., It only worked after rebuilding the model after the upgrade, but there were no validation messages prior to rebuilding the model to tell me what was wrong (if anything). The only thing I changed this time round was removing all the columnName = "" definitions from the prototypes model. I was attempting to narrow down what the problem was but that it's now working is weird.

    It seems to me that there's more validation needed for the models.

    I've also noticed that the derived attributes have a 'columnName = "";' declaration, or 'columnName = companyId;'. Though it doesn't say so in the reference docs, but certainly implied by the fact that you cannot define both simultaneously in either EOModeler or Entity Modeler, I believe that 'columnName' and 'definition' ought to be treated as mutually exclusive and not appear in the plist file for an EOAttribute together. i.e., if an attribute is derived then remove the columnName declaration; if not derived then remove 'definition' declation.

    If I can also request (for consistency and in order to clean up wrong declarations created either by hand or by past versions of Entity Modeler) that inherited attributes or relationships be fixed where the parent declation differs from the child. i.e., as stupid as it is - the only difference between an inherited attribute definition and the parent's is that the child definition swaps the columnName for a definition (such as 'person.firstName'). Otherwise it should have an exact copy of the other bits such as externalType and so forth. Naturally whether its a class property or not ought to be dictated by the parent.

    Thanks.

    -- 
    This message is automatically generated by JIRA.
    -
    If you think it was sent incorrectly contact one of the administrators: http://issues.objectstyle.org/jira/secure/Administrators.jspa
    -
    For more information on JIRA, see: http://www.atlassian.com/software/jira
    



    This archive was generated by hypermail 2.0.0 : Sun May 20 2007 - 01:32:10 EDT