0 Replies Latest reply on Sep 8, 2003 10:27 AM by Radu Mateescu

    Default values in database and CMP

    Radu Mateescu Newbie

      Hello
      I have this problem: during creation, a timestamp required field in the database is defaulted to the now() value if an input is not specified. How can I represent this in CMP? If the cmp-field is not read-only, the engine defaults the value to null (which is not what I want) instead of using the database 'default' keyword (which I think is a SQL standard). If the timestamp field is marked as read-only it is not included in the generated insert and is always defaulted by the database. But this is again not what I want, because when the input is specified I want to use that value and not the default one.
      Another solution would be to programmatically determine the timestamp (either use the specified input or calculate the default if no input is provided), but I want to rely here exclusively on the database support

      I am using JBoss 3.2 RC3 and Postgres 7.3
      Any suggestion would be highly appreciated
      Thanks
      Radu