java - columnDefinition="DATE DEFAULT SYSDATE", don't work -


i using code:

@column(name = "fecha_creacion_timestamp",columndefinition="date default sysdate", insertable=false) @temporal(temporaltype.timestamp) private date fechacreaciontimestamp;  

but when insert data table, doesn't have date have date null.

updated answer: (now know using oracle)

what need make sure column doesn't included in insert statements. that, need update @column annoation like:

@column(..other properties.., insertable = false) 

see here more details.

now, need make sure generated value available in domain object after perform insert. if using hibernate, , not mind using hibernate annotations, can put following annotation on field.

@org.hibernate.annotations.generated(org.hibernate.annotations.generationtime.insert) 

hibernate automatically perform required select query you.

if not using hibernate, need select fetch generated value after performing insert. jpa doesn't have specify should done automatically.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -