You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by chintan4181 <ch...@gmail.com> on 2011/03/31 22:45:33 UTC

timestamp issue while retrieving from database

We are using sql server 2005 as a datbase and most of tables are having
column called "timestamp". timestamp is used typically as a mechanism for
version-stamping table rows by sql server.

When I query a object using named query, OpenJPA throws an exception saying
: 
 com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from
timestamp to TIMESTAMP is unsupported

My generated entity has timestamp mapped with java.sql.TimeStamp.

Is there a way to get the whole object except timestamp column or how can i
solve this issue?

Please advice.

Thanks
chintan

--
View this message in context: http://openjpa.208410.n2.nabble.com/timestamp-issue-while-retrieving-from-database-tp6228699p6228699.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: timestamp issue while retrieving from database

Posted by chintan4181 <ch...@gmail.com>.
Hi,

Got the solution. mssql "timestamp" datatype is mapped to java "byte"
datatype. after chaning from java.sql.TimeStamp to byte[]. it worked.

Thanks
chintan


--
View this message in context: http://openjpa.208410.n2.nabble.com/timestamp-issue-while-retrieving-from-database-tp6228699p6231375.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: timestamp issue while retrieving from database

Posted by Rick Curtis <cu...@gmail.com>.
Chintan -

A few questions for you.

1.] What version of OpenJPA are you running?
2.] Can we see the entire exception?
3.] What is in your persistence.xml?
4.] What do you have for annotations on the field that is being mapped to
the timestamp column?

Thanks,
Rick

On Thu, Mar 31, 2011 at 3:45 PM, chintan4181 <ch...@gmail.com> wrote:

> We are using sql server 2005 as a datbase and most of tables are having
> column called "timestamp". timestamp is used typically as a mechanism for
> version-stamping table rows by sql server.
>
> When I query a object using named query, OpenJPA throws an exception saying
> :
>  com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from
> timestamp to TIMESTAMP is unsupported
>
> My generated entity has timestamp mapped with java.sql.TimeStamp.
>
> Is there a way to get the whole object except timestamp column or how can i
> solve this issue?
>
> Please advice.
>
> Thanks
> chintan
>