Extending cayenne-class

From: Halbig Thomas (thomas.halbi..interthur.ch)
Date: Thu Jan 23 2003 - 03:05:21 EST

  • Next message: Andrus Adamchik: "Re: Extending cayenne-class"

    Hi,

    I' have a little question and I hope I will get some help.

    I extended a helper class from my cayenne class, because I need some formatted datas so I had to overwrite the original cayenne method. I had to overrwrite the constructur to get the datas in the helper. (s.below)

    public class CmTransactionHelper extends CmTransaction {

            public CmTransactionHelper(CmTransaction cmTransaction)
            {
                    super();
                    
                    super.setAmount(cmTransaction.getAmount());
                    super.setFkAccountId(cmTransaction.getFkAccountId());
                    super.setFkUserId(cmTransaction.getFkUserId());
                    super.setFkCreatorId(cmTransaction.getFkCreatorId());
                    super.setFkTransactionTypeId(cmTransaction.getFkTransactionTypeId());
                    super.setText(cmTransaction.getText());
                    super.setTimestamp(cmTransaction.getTimestamp());
                    super.setValutaTimestamp(cmTransaction.getValutaTimestamp());
                    super.setCm_transactionAccount(cmTransaction.getCm_transactionAccount());
                    super.setCm_transactionCreator(cmTransaction.getCm_transactionCreator());
                    super.setCm_transactionTransactionType(cmTransaction.getCm_transactionTransactionType());
                    super.setCm_transactionUser(cmTransaction.getCm_transactionUser());
                    super.setDataContext(cmTransaction.getDataContext());
            }
            
            public String getTimestampFormatted()
            {
                    return Formatter.dateToString_DDMMYYYY(super.getTimestamp());
            }
    }

    My problem is, that I got every time a Nullpointer-Exception when I try to call the methods of the relation:
            super.setCm_transactionAccount(cmTransaction.getCm_transactionAccount());

    When I don't add the "setCm_ ..." in this constructor, I will get the NullPointer-Exception from struts!!

    <logic:iterate id="transaction" name="TransactionForm" property="transactionList" type="com.winterthur.cm.model.CmTransactionHelper">
         <bean:define id="transactiontextkey" name="transaction" property="cm_transactionTransactionType.descriptionKey"/>
         <td width="54%" class="centertext"><bean:message key="<%= transactiontextkey.toString() %>"/>-<bean:write name="transaction" property="text"/></td>
    </logic:iterate>

    When I don't use this helper-class and fill my list whith the Cayenne-class, all works fine!
    Any clue, what I'm doin wrong, when I extended the cayenne-class?

    Thanks in advance
    Thomas



    This archive was generated by hypermail 2.0.0 : Thu Jan 23 2003 - 03:06:27 EST