I can reproduce this problem against DB2. It looks like that this problem is 
generic, independent of the backend. The jdbc trace shows:
7828  CustomerOrder  TRACE  [main] openjpa.jdbc.SQL - <t 1090273532, conn 
582492856> executing prepstmnt 1346129980 INSERT INTO EntityA (id, amt, 
creationts, name) VALUES (?, ?, ?, ?) [params=(int) 1, (double) 0.0, (null) 
null, (null) null]. 

Shouldn't Openjpa formulate the insert statement as:
   INSERT INTO EntityA (id, amt) VALUES(?,?) 
and exclude the columns from the insert statement where the values are null? 

-fay

--- On Tue, 8/5/08, Marcel Ruff <[EMAIL PROTECTED]> wrote:

> From: Marcel Ruff <[EMAIL PROTECTED]>
> Subject: How to apply creation timestamp with
> To: [email protected]
> Date: Tuesday, August 5, 2008, 2:14 AM
> Hi,
> 
> i need to set for Postgres 8.3.x on new table entry
> creation a timestamp 
> and have tried this:
> 
>     @Column(name = "creationts",
> columnDefinition="timestamp not null 
> default current_timestamp")
>     public java.sql.Timestamp getCreationTs() {  return
> creationTs; }
> 
> The dll applied to Postgres directly works fine and creates
> the 
> timestamp during insert on the fly.
> 
> Using openJpa i get:
> 
>   org.apache.openjpa.persistence.PersistenceException:
> ERROR: null value 
> in column "creationts" violates not-null
> constraint
> 
> what can i do?
> 
> Thanks
> Marcel
> 
> -- 
> Marcel Ruff
> http://watchee.net


      

Reply via email to