Skip to content
Advertisement

how to store date AND time with JPA in Oracle?

I’m using WebSphere 7 (Java EE 5) and OpenJPA 1.2.1.

I have a JPA object with a “modifiedTimestamp” attribute, something like this:

JavaScript

The related field in the Oracle database is of type DATE.

I set the date like so …

JavaScript

… and it gets stored, but when I read it back the time of day hasn’t been stored, it allows comes back as 24:00.

Is this a JPA thing, or an Oracle thing? Any suggestions are greatly appreciated!

Thanks

Advertisement

Answer

Anotating your field and changing the type should help:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement