[Opensource] Réf. : RE: Bug when using DBObject.setField ("name", new

Raul DAVIDOVICH R.DAVIDOVICH at caconcology.com
Thu Feb 19 03:32:49 PST 2004


Hello all,

I finally found it... in fact the code was working right, and setField
("name", new Date()) actually did what it expected.
The issue came from the fact that I activated the change log in my
DBObjects with the enableLogging() method. This method relies on
com.jcorporate.expresso.services.dbobj.ChangeLog which overrides add() with
the following:

public synchronized void add()
            throws DBException {
        Date d = new Date();

// PROBLEM HERE!!!!!
        String currDate = DateFormat.getDateTimeInstance(DateFormat.SHORT,
                DateFormat.MEDIUM).format(d);

        setField("ChangeTime", currDate);

        super.add();
    } /* add() */


I changed it to:
    public synchronized void add()
            throws DBException {

        setField("ChangeTime", new Date());

        super.add();
    } /* add() */

and it works ok.

I also had to add the following line in constructDBObjects() of
com.jcorporate.expresso.core.ExpressoSchema:

protected void constructDBObjects() throws DBException{
...
// ADDED THIS LINE
    addDBObject(com.jcorporate.expresso.services.dbobj.ChangeLog.class);
...
}


Best regards,
---------------------------------------------------
Raul Davidovich
Responsable Informatique
Cvitkovic & Associés Consultants

(33) 1 45 15 40 68
(33) 1 45 15 40 41 Fax
-------------------------------------------------------
http://www.caconcology.com


|---------+---------------------------->
|         |           "Goeltz, Rick"   |
|         |           <goeltzrt at ornl.go|
|         |           v>               |
|         |                            |
|         |           18/02/2004 15:54 |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                                  |
  |       Pour :    Raul DAVIDOVICH <R.DAVIDOVICH at caconcology.com>                                                                                   |
  |       cc :                                                                                                                                       |
  |       Objet :   RE: Bug when using DBObject.setField("name", new                                                                                 |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|




Raul:

> The aplication will be deployed agains SQL Server (or Oracle with a
bit of
> luck)

I did a brief app against SQL Server and I have a major app on Oracle.
I'm pretty sure I edited the expresso-config.xml for Oracle example
because it has a time field in the template for setting a date.  So,
watch out for that.

... Rick









More information about the Opensource mailing list