tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <>
Subject Re: Date format for Column Conversion, String on Bean, Date on Database
Date Tue, 14 Jun 2011 06:00:18 GMT

i think it is more a database issue than a software one.

you can still use a simple date format in java to have this format (in your
getter for example) but it will always depend on the database value and i'm
not sure you'll have exactly what you need.

- Romain

2011/6/14 rnieto <>

> 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
> 2008).
> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message