1 Reply Latest reply on Jun 4, 2004 9:06 PM by awlzac

    CMP update of timestamp field overwrites other db fields

    awlzac Newbie


      Cheers all,

      I'm sure this is something stupid I'm overlooking...

      (jboss-3.2.2RC4/jetty; redhat linux8.0; oracle8.1.7)

      When updating objects using CMP, I've noticed that if I update a DATE field in the db that's mapped to java.sql.Timestamp, it clobbers other fields in the table (!). If I update a DATE field in the db that's mapped to java.sql.Date, it doesn't (but of course loses hh:mm:ss precision, which I need.)

      in other words, in a stateless session bean I'll do:

      myobject.setDeliverydate(some_timestamp);

      and after the method (i.e. current transaction) exits, a *different* cmp field in myobject will be clobbered. In my case, it's a CHAR field called "status", and the first few characters get overwritten, in the database(!)

      I tried changing the default datasource-mapping in standardjbosscmp-jdbc.xml to Oracle8, but I apparently don't know what I'm doing, because that did nothing. At moment, I've resorted to re-setting the clobbered value after return to the calling method, which is obviously violently temporary.

      Any pointers would be much appreciated!

      Tim