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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -