If you map the field in the usual way, but don't specify an explicit value in the javabean you are storing, OJB will explicitely set it "null" in the DB:
insert into my table (......, my_timestamp_field) values(......., NULL);
(supposing you are at broker level).

If your timestamp is filled in automatically by the DB (say by a default value or by trigger), and if you don't want that value to change in the future, use something like <field-descriptor *access="readonly"* name="myTimeStamp" column="my_timestamp_field"* ... />
*=> OJB won't include it in the insert/update SQLs.

HTH,

**
*Alexandre BORGOLTZ**
*Head of Technology

**SmartJog SA*
*Phone: +33 (0)1 4996 6324
Fax: +33 (0)1 4996 6405
Mobile: +33 (0)6 8882 1417
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>


A Leg wrote:

Hi

I use OJB with postgres.
When using postgres without Ojb, I use TimeStamp, by creating some table field, non nullable and TimeStamp.
Like that every time we enter data, a timeStamp is created in this field.

But with Ojb I get an error telling me that I am trying to create a record with a null value in a non nullable field. Caused by: org.postgresql.util.PSQLException: ERROR : null value in column "created" violates not-null constraint.

How can I solve this issue ?

Best regards

Andre Legendre

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


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

Reply via email to