You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Marcin Skladaniec (JIRA)" <ji...@apache.org> on 2011/02/09 03:32:57 UTC

[jira] Created: (CAY-1538) superclass generation with inheritance

superclass generation with inheritance
--------------------------------------

                 Key: CAY-1538
                 URL: https://issues.apache.org/jira/browse/CAY-1538
             Project: Cayenne
          Issue Type: Bug
            Reporter: Marcin Skladaniec
            Priority: Minor


preconditions: cayenne model with inherited object entities.
suspected bug: the resulting generated classes are duplicating property keys, getters and setters

For example defining entity Apple inheriting from entity Fruit will generate following set of classes:

Apple extends _Apple extends Fruit extends _Fruit

The _Fruit.java defines all property keys, getters and setters for the attributes and relationships, also the PK column. _Apple.java does not have to re-define those, yet it only skips attributes, and keeps re-defining relationships and PK. (please see the pseudocode example below)

not sure if that is intended or not.


_Fruit.java
//attributes
    public static final String KIND_PROPERTY = "kind";
    public static final String WEIGHT_PROPERTY = "weight"
//relationships
    public static final String SUPPLIER_PROPERTY = "supplier";

//PK
    public static final String ID_PK_COLUMN = "id";

//attribute getters/setters
getKind()
setKind()
getWeight()
setWeight()
//relationship getters/setters
getSupplier()
setSupplier()


_Apple.java
//attributes
skipped...
//relationships
    public static final String SUPPLIER_PROPERTY = "supplier";

//PK
    public static final String ID_PK_COLUMN = "id";

//attribute getters/setters
skipped...
//relationship getters/setters
getSupplier()
setSupplier()


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CAY-1538) superclass generation with inheritance

Posted by "Marcin Skladaniec (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12992331#comment-12992331 ] 

Marcin Skladaniec commented on CAY-1538:
----------------------------------------

workaround for this issue is to define the relationships on the inheriting class level, not the base entity.

> superclass generation with inheritance
> --------------------------------------
>
>                 Key: CAY-1538
>                 URL: https://issues.apache.org/jira/browse/CAY-1538
>             Project: Cayenne
>          Issue Type: Bug
>            Reporter: Marcin Skladaniec
>            Priority: Minor
>
> preconditions: cayenne model with inherited object entities.
> suspected bug: the resulting generated classes are duplicating property keys, getters and setters
> For example defining entity Apple inheriting from entity Fruit will generate following set of classes:
> Apple extends _Apple extends Fruit extends _Fruit
> The _Fruit.java defines all property keys, getters and setters for the attributes and relationships, also the PK column. _Apple.java does not have to re-define those, yet it only skips attributes, and keeps re-defining relationships and PK. (please see the pseudocode example below)
> not sure if that is intended or not.
> _Fruit.java
> //attributes
>     public static final String KIND_PROPERTY = "kind";
>     public static final String WEIGHT_PROPERTY = "weight"
> //relationships
>     public static final String SUPPLIER_PROPERTY = "supplier";
> //PK
>     public static final String ID_PK_COLUMN = "id";
> //attribute getters/setters
> getKind()
> setKind()
> getWeight()
> setWeight()
> //relationship getters/setters
> getSupplier()
> setSupplier()
> _Apple.java
> //attributes
> skipped...
> //relationships
>     public static final String SUPPLIER_PROPERTY = "supplier";
> //PK
>     public static final String ID_PK_COLUMN = "id";
> //attribute getters/setters
> skipped...
> //relationship getters/setters
> getSupplier()
> setSupplier()

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira