tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnieto <>
Subject Date format for Column Conversion, String on Bean, Date on Database
Date Tue, 14 Jun 2011 05:54:18 GMT
I'd like to ask if there's a way to specify the behavior on how it would
handle querying Date columns and converting them to a String attribute on
the java bean. (We're using OpenEJB 3.1.4, tomcat 6, JTDS and MS SQL Server

History, why we're using String:
Previously we were having problems with OpenEJB 3.1, we were just querying
for a row of data on the database. Out set-up involved the table being able
to be inserted into, queried, but there was this date field that can never
be updated.

Think of it like this: In today's systems if you're doing trial version
software, there's the First Installed date. A date which cannot be changed
or updated as any user can update that field making the software run longer
instead of 30 days. The user can query and look when he first installed it,
and other information related to the user.

The problem appeared that after querying for the row, somewhere within
OpenEJB 3.1 an update was also being issued to the same row we just queried.
Since it isn't allowed to update that specific column, we were getting
exceptions about being unable to issue an update. The odd thing, after other
people ran SQL Server Profiler, they saw that it was issuing an update right
after the select statement, wherein the data is still 100% the same. When we
changed the data type of the column on the Java bean to String, only the
select statement is now being issued. 

Now we're tasked to locate on how to control the query wherein it should
specifically convert the datetime into a certain format, for our case
(YYYY-MM-DD HH:MM:SS.SSS). This is to guarantee that the format would always
be the same to whatever deployed database it uses. 

I've searched high and low, and I'm not sure whether this is really a
configurable item within OpenEJB or OpenJPA.

View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message