Hello,

  How do you model a table in repository.xml with a
non-nullable field that has a dynamic default value
which will be filled up by the RDBMS. For instance,
an order table with the following fields

order_id      int       non-nullable
customer_id   int       non-nullable
date_created  datetime  non-nullable  CURRENT_TIMESTAMP

  Using SQLServer, the date_created has the default
value of CURRENT_TIMESTAMP which returns the database
system's current time. The respository looks something
like this:

     <field-descriptor id="1"
         name="orderId"
         column="order_id"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
      />
      <field-descriptor id="2"
         name="customerId"
         column="customer_id"
         jdbc-type="INTEGER"
      />
      <field-descriptor id="3"
         name="dateCreated"
         column="date_created"
         jdbc-type="TIMESTAMP"
      />

  If I create a new record using ODMG and leaving
the date_created value as null, an error will occur.
(The INSERT INTO TABLE command lists all the fields
and hence an error when a null is assigned to a
non-nullable field.)

  A workaround is to leave out the date_created field
in the respository so that the INSERT INTO TABLE
command will not have the field. The database server
will fill that missing field with the default value.
However, that would also mean that I cannot read back
the date created since the corresponding BO will not
be filled with the date created upon reading from the
table.

  Because of requirements, I cannot use the timestamp
from the Java web server which resides on another
machine. Or is there a way to get the current timestamp
from the database server via OJB?

  Regards,

Ralph Tan.
-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to