hello
        if you want the database to fill the values always, use  access="readonly" in 
those fields 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 6:31 PM
To: [EMAIL PROTECTED]
Subject: INSERT with empty fields OJB / MySQL


Hello,
I'm running ojb v. 1.0.rc4-src.
I have a domain object containing some java.sql.Timestamp attributes that might be 
empty. When I insert them into the datbase via ojb, the empty date-attribues are 
filled with the current date. I have logged the insert statement with p6spy it looks 
like this:

INSERT INTO T (ID,C_ID,RECEPTION_DATE) VALUES ('123','76','')

The mysql-db changes '' to the current date.

My repository-xml looks like this:

class-descriptor class="com.yyy.T" table="T">
        <field-descriptor name="id" primarykey="true" nullable="false" column="ID" 
jdbc-type="VARCHAR"/>
        <field-descriptor name="cId" column="C_ID" jdbc-type="VARCHAR"/>
        <field-descriptor name="receptionDate" column="RECEPTION_DATE" 
jdbc-type="TIMESTAMP"/>
</class-descriptor>

My table in the database looks like this
+-----------------+---------------+------+-----+---------+-------+
| Field           | Type          | Null | Key | Default | Extra |
+-----------------+---------------+------+-----+---------+-------+
| T_ID            | varchar(22)   |      | PRI |         |       |
| C_ID            | varchar(22)   | YES  |     | NULL    |       |
| RECEPTION_DATE  | timestamp(14) | YES  |     | NULL    |       |


Is there a possibilty to configure ojb to use null instead of '' or even to write 
insert statements that only contain the attributes that are != null?
Or any other workaround?


Thank you


Volker Konrad

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

This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or 
copying of this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

                Visit us at http://www.cognizant.com

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

Reply via email to