You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Oleg Artyukevich (JIRA)" <ji...@apache.org> on 2013/12/31 12:50:51 UTC

[jira] [Comment Edited] (CAY-1795) "Invisible" ObjAttribute in subclass

    [ https://issues.apache.org/jira/browse/CAY-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13859455#comment-13859455 ] 

Oleg Artyukevich edited comment on CAY-1795 at 12/31/13 11:49 AM:
------------------------------------------------------------------

Patch for 3.2 version. Changes between last patch: 
 - permit to save project while attributes has wrong names. Names rolled back to previous valid values before save.
 - attribute validator changed its superclass. Its like other validators in Cayenne now. 


was (Author: olegart):
Patch for 3.2 version. Changes between last patch: 
 - permit to save project while attributes has wrong names. Names rolled back to previous valid values before save.
 - attribute validator changed its superclass. It like other validators in Cayenne now. 

> "Invisible" ObjAttribute in subclass
> ------------------------------------
>
>                 Key: CAY-1795
>                 URL: https://issues.apache.org/jira/browse/CAY-1795
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Modeler
>    Affects Versions: 3.1B1, 3.2M1
>            Reporter: Andrus Adamchik
>             Fix For: 3.2.M2
>
>         Attachments: ModelerObjAttribute.patch, ModelerObjAttribute_2.patch, ModelerObjAttribute_2_simplified.patch, ModelerObjAttribute_3.patch, ModelerObjAttribute_4.patch, cay1795.patch, v7upgrade.patch, v7upgradeTest.patch, v7upgrade_2.patch
>
>
> This is a two-fold issue with "invisible" attributes that are possible to map via the Modeler, and that are causing runtime problems.. Scenario to reproduce:
> * Open the modeler
> * Create new DataMap 
> * Create new DbEntity with a PK column
> * Create new ObjEntity based on DbEntity above and map meaningful PK
> * Create another ObjEntity that is a subclass of the ObjEntity above
> * Add ObjAttribute to subclass and use the same name as the meaningful PK attribute. Hit "Enter" in the name field - attribute disappears. The user assumes this was because the attribute is already defined in the superclass.. 
> * Save the project - subclass ObjAttribute appears in the XML:
> <data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
> 	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	 xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
> 	 project-version="6">
> 	<db-entity name="db_entity">
> 		<db-attribute name="untitledAttr" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
> 	</db-entity>
> 	<obj-entity name="DbEntity" dbEntityName="db_entity">
> 		<obj-attribute name="untitledAttr" type="java.lang.Integer" db-attribute-path="untitledAttr"/>
> 	</obj-entity>
> 	<obj-entity name="ObjEntity" superEntityName="DbEntity">
> 		<obj-attribute name="untitledAttr"/>
> 	</obj-entity>
> </data-map>
> I.e. subclass attribute is there, but it is invisible in the Modeler. 
> Now problem number two is caused by invisible attribute in runtime. A SelectQuery against super that fetches some sub entities , returns NULL elements in the result list. 
> Fix ideas...
> As a minor improvement we may kill such "shadow" attribute in runtime and print a warning, but I guess the real fix should be on the Modeler end - complain about a name that matches super name. And if the super was renamed to create sub conflict, display a validation error on save. And do not hide the attribute if it was added - the user should be able to see it and remove/rename if needed.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)