You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Dzmitry Kazimirchyk (Closed) (JIRA)" <ji...@apache.org> on 2011/10/11 14:29:11 UTC

[jira] [Closed] (CAY-1477) Modeler: Better validation for erroneous horizontal inheritance mapping

     [ https://issues.apache.org/jira/browse/CAY-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dzmitry Kazimirchyk closed CAY-1477.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1M4
    
> Modeler: Better validation for erroneous horizontal inheritance mapping
> -----------------------------------------------------------------------
>
>                 Key: CAY-1477
>                 URL: https://issues.apache.org/jira/browse/CAY-1477
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Modeler
>    Affects Versions: 3.0
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1M4
>
>
> see http://markmail.org/message/eplorawsepzva4ux for details. 
> If a user erroneously maps subclass to the same table as superclass (instead of leaving it blank), Cayenne generates incorrect queries in runtime. Also the Modeler seems to go nuts. Flattened attributes mapping stops working for instance. I was getting exceptions like:
> Caused by: java.lang.NullPointerException
> 	at org.apache.cayenne.modeler.dialog.objentity.ObjAttributeInfoDialog.isChange(ObjAttributeInfoDialog.java:512)
> 	at org.apache.cayenne.modeler.dialog.objentity.ObjAttributeInfoDialog.setPath(ObjAttributeInfoDialog.java:419)
> 	at org.apache.cayenne.modeler.dialog.objentity.ObjAttributeInfoDialog.saveMapping(ObjAttributeInfoDialog.java:519)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	
> So since specifying a table different than superclass would constitute unsupported horizontal inheritance, it probably shouldn't be allowed (we should disable the conbobox if superclass is selected). For sanity sake (and to cleanly "upgrade" the existing bad mappings) we should probably check subclass DbEntity value on save and quitely remove it if it is same as superclass, and give a validation error if it is not.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira