You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jonathan Feinberg (JIRA)" <ji...@apache.org> on 2007/06/12 19:27:26 UTC

[jira] Created: (OPENJPA-257) Getter/Setter type inconsistency in Entity IdClass

Getter/Setter type inconsistency in Entity IdClass
--------------------------------------------------

                 Key: OPENJPA-257
                 URL: https://issues.apache.org/jira/browse/OPENJPA-257
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 1.0.0
            Reporter: Jonathan Feinberg
            Priority: Critical


In this excerpt from ClassMetaData, we are seeking getter and setter in an identity class. We should be seeking getter and setter with type of Entity class's *key*, not type of Entity class per se. The getter code refers to "c", which was earlier set to the correct object id field type. But the setter-seeking code refers incorrectly to "fmds[i].getDeclaredType()". This is a show-stopper, as it makes OpenJPA manual section 3.2 un-implementable.

if (m == null || !m.getReturnType().isAssignableFrom(c))
                    throw new MetaDataException(_loc.get("invalid-id",
                        _type, fmds[i].getName()));
                m = Reflection.findSetter(oid, fmds[i].getName(),
                    fmds[i].getDeclaredType(), false);
                if (m == null || m.getReturnType() != void.class)
                    throw new MetaDataException(_loc.get("invalid-id",
                        _type, fmds[i].getName()));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-257) Getter/Setter type inconsistency in Entity IdClass

Posted by "Jonathan Feinberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Feinberg updated OPENJPA-257:
--------------------------------------

    Priority: Major  (was: Critical)

> Getter/Setter type inconsistency in Entity IdClass
> --------------------------------------------------
>
>                 Key: OPENJPA-257
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-257
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 1.0.0
>            Reporter: Jonathan Feinberg
>
> In this excerpt from ClassMetaData, we are seeking getter and setter in an identity class. We should be seeking getter and setter with type of Entity class's *key*, not type of Entity class per se. The getter code refers to "c", which was earlier set to the correct object id field type. But the setter-seeking code refers incorrectly to "fmds[i].getDeclaredType()". This is a show-stopper, as it makes OpenJPA manual section 3.2 un-implementable.
> if (m == null || !m.getReturnType().isAssignableFrom(c))
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));
>                 m = Reflection.findSetter(oid, fmds[i].getName(),
>                     fmds[i].getDeclaredType(), false);
>                 if (m == null || m.getReturnType() != void.class)
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-257) Getter/Setter type inconsistency in Entity IdClass

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-257:
----------------------------------

    Attachment: jira257.patch

Attached patch to find  Application Identity class' setter method with correct parameter type.  

> Getter/Setter type inconsistency in Entity IdClass
> --------------------------------------------------
>
>                 Key: OPENJPA-257
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-257
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 1.0.0
>            Reporter: Jonathan Feinberg
>         Attachments: jira257.patch
>
>
> In this excerpt from ClassMetaData, we are seeking getter and setter in an identity class. We should be seeking getter and setter with type of Entity class's *key*, not type of Entity class per se. The getter code refers to "c", which was earlier set to the correct object id field type. But the setter-seeking code refers incorrectly to "fmds[i].getDeclaredType()". This is a show-stopper, as it makes OpenJPA manual section 3.2 un-implementable.
> if (m == null || !m.getReturnType().isAssignableFrom(c))
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));
>                 m = Reflection.findSetter(oid, fmds[i].getName(),
>                     fmds[i].getDeclaredType(), false);
>                 if (m == null || m.getReturnType() != void.class)
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-257) Getter/Setter type inconsistency in Entity IdClass

Posted by "Jonathan Feinberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503949 ] 

Jonathan Feinberg commented on OPENJPA-257:
-------------------------------------------

I can work around it by declaring both

void setFoo(String fooKey) { foo = fooKey; }

void setFoo(Foo foo) { foo = foo.getId() }

In the identity class, but this is cheesy.

> Getter/Setter type inconsistency in Entity IdClass
> --------------------------------------------------
>
>                 Key: OPENJPA-257
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-257
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 1.0.0
>            Reporter: Jonathan Feinberg
>            Priority: Critical
>
> In this excerpt from ClassMetaData, we are seeking getter and setter in an identity class. We should be seeking getter and setter with type of Entity class's *key*, not type of Entity class per se. The getter code refers to "c", which was earlier set to the correct object id field type. But the setter-seeking code refers incorrectly to "fmds[i].getDeclaredType()". This is a show-stopper, as it makes OpenJPA manual section 3.2 un-implementable.
> if (m == null || !m.getReturnType().isAssignableFrom(c))
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));
>                 m = Reflection.findSetter(oid, fmds[i].getName(),
>                     fmds[i].getDeclaredType(), false);
>                 if (m == null || m.getReturnType() != void.class)
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-257) Getter/Setter type inconsistency in Entity IdClass

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick resolved OPENJPA-257.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0.0

Looks like this has already been fixed, or at any rate Pinaki's change is already committed. 

> Getter/Setter type inconsistency in Entity IdClass
> --------------------------------------------------
>
>                 Key: OPENJPA-257
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-257
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 1.0.0
>            Reporter: Jonathan Feinberg
>             Fix For: 1.0.0
>
>         Attachments: jira257.patch
>
>
> In this excerpt from ClassMetaData, we are seeking getter and setter in an identity class. We should be seeking getter and setter with type of Entity class's *key*, not type of Entity class per se. The getter code refers to "c", which was earlier set to the correct object id field type. But the setter-seeking code refers incorrectly to "fmds[i].getDeclaredType()". This is a show-stopper, as it makes OpenJPA manual section 3.2 un-implementable.
> if (m == null || !m.getReturnType().isAssignableFrom(c))
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));
>                 m = Reflection.findSetter(oid, fmds[i].getName(),
>                     fmds[i].getDeclaredType(), false);
>                 if (m == null || m.getReturnType() != void.class)
>                     throw new MetaDataException(_loc.get("invalid-id",
>                         _type, fmds[i].getName()));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.