[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-1969) updatedMessage, deletedMessage and createdMessage in framework.Home cause NPE if getEntityClass is overridden

Dan Allen (JIRA) jira-events at lists.jboss.org
Tue Oct 2 22:04:03 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-1969?page=all ]

Dan Allen updated JBSEAM-1969:
------------------------------

    Attachment: JBSEAM-1969-v1.txt

This problem is actually really simple to fix. Direct access to the entityClass private field just needs to be replaced with calls to the getter, as follows:

getEntityClass() instead of entityClass

However, there is one question. The @Create method calls getEntityClass(), which must be non-null and establishes the value of the entityClass private field. That begs the question, should subclasses be forced to call setEntityClass() in the getEntityClass() override?

I am inclined to say that we should follow good OO principles and access the field using the getter method to support overrides such as this.

However, the same problem will come up if you try to override getId(). I think in that case it is okay to enforce the call to setId() since that is a very special property.

> updatedMessage, deletedMessage and createdMessage in framework.Home cause NPE if getEntityClass is overridden
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-1969
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1969
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Framework
>         Environment: Mac OSX 10.4.8, Jboss 4.2.1, Seam 1.3.0 
>            Reporter: Damian Harvey
>         Assigned To: Pete Muir
>            Priority: Trivial
>             Fix For: 2.0.1.GA
>
>         Attachments: JBSEAM-1969-v1.txt
>
>
> I am extending an existing class (BookingHome) that extends EntityHome. My BookingHome class needs to override getEntityClass. Doing this then results in a NPE as updatedMessage, deletedMessage and createdMessage refer to entityClass rather than getEntityClass.

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

        



More information about the seam-issues mailing list