Storing java.sql.Timestamp type into HSQL database -


we have multiple databases our application.

the date of type java.sql.timestamp being stored in datetime data type of sql server.

but

for storing same type in hsql db, using timestamp, , not able cast it.

i not able change in java code because working in sql server , oracle both, need casting in hsql query only.

current working query sql server datetime field is:

insert system_documents values(?) 

java code:

timestamp=new java.sql.timestamp(new java.util.date().gettime()); string q="insert system_documents values(?)"; pstm = con.preparestatement(q); pstm.settimestamp(1, timestamp); pstm.executequery(); 

if you're using hibernate can simple adding @temporal annotation

 @temporal(temporaltype.date)  private date date; 

temporal has timestamp, date, time enums


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -