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
Post a Comment