[Opensource] Questions about DBMaint

Michael Rimov rimovm at centercomp.com
Wed Jul 16 19:43:31 PDT 2003


At 11:36 AM 7/16/2003 -0400, you wrote:
>    I have this question about DBMaint and inserting entries into the
>database. I have extended the DBMaint to EntryDBMaint. And I have added
>setReadOnly to a couple of fields in my dbobject Entry field so that
>they won't show up when the EntryDBMaint is rendering the jsp.
>
>    addField(FLD_USER,"int",30,false,"User Name");
>    setReadOnly(FLD_USER);
>    addField(FLD_DATE,"datetime",0,false,"Date and Time");
>    setReadOnly(FLD_DATE);
>
>But when I go to add using the state AddUpdate, I get a JBDCExecutor
>error because not all the fields are filled. I have already tried using
>the add method in the Entry dbobj to get those field manually entered in
>to no avail. I have a couple of ideas in my head such as to extend the
>AddUpdate class and add those fields in manually there, but I wanted to
>see if there was any "correct" ways to do it.


Hi Tino,

Overriding the base class' add like so:

public void add() throws DBException {
         setField("ReadOnlyField1", "abcdefg");
         setField("ReadOnlyField2", "hijklmnop");
         super.add();
}

SHOULD work.  Perhaps you have either a bug [doubt it since the use of that 
kind of code is common.. or something else???]
                                                         -Mike







More information about the Opensource mailing list