Hi,
With MySQL this is what happens:
1. Definition of a column with default timestamp value
@Column(name="ts", columnDefinition="TIMESTAMP DEFAULT
CURRENT_TIMESTAMP")
private Timestamp ts;
2. OpenJPA issues SQL to create the table:
CREATE TABLE AutoInc (id BIGINT NOT NULL, ts TIMESTAMP DEFAULT
CURRENT_TIMESTAMP, PRIMARY KEY (id))
3. OpenJPA issues SQL for insert when application does not set the value of
ts field:
INSERT INTO AutoInc (id, ts) VALUES (?, ?) [params=(long) 100, (null)
null]
4. This is what database looks like:
mysql> select * from autoinc;
+-----+---------------------+
| id | ts |
+-----+---------------------+
| 100 | 2008-08-06 12:47:29 |
+-----+---------------------+
--
View this message in context:
http://n2.nabble.com/How-to-apply-creation-timestamp-with-tp673210p676450.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.