Discussion:
[Middlegen-user] java.sql.Date vs java.sql.Timestamp
Kasper Nielsen
2002-07-31 11:34:02 UTC
Permalink
Hi,

I have a table with a TIMESTAMP column, however middlegen 'translates' it
such that a java.sql.Date getter/setter is created.
Im sure I had a version once where this wasn't a problem.

- Kasper
a***@netcom.no
2002-07-31 12:05:04 UTC
Permalink
Middlegen translates JDBC types to Java types according to a table that
is included in Sun's JDBC documentation. I can't remember exactly from
where I copied it, but you'll find it under middlegen/docs/resultset.gif
The middlegen.java.Sql2Java class "implements" this table. Take a peek
at the bottom of this class to see the mapping from SQL types to Java
types.

If a prefs file exists, Middlegen will use the type in the prefs file
(so that if you change the type, Middlegen will remember it the next
time. Requires JDK 1.4) - and ignore the type reported by Sql2Java.
Maybe you have a prefs file that says "use java.sql.Date for
Footable.Barcolumn"? Try to delete the prefs file.

Another possibility is that although you have defined the database
column as TIMESTAMP, the JDBC driver reports that the type is
java.sql.Types.DATE. Those JDBC drivers sure are weird sometimes! In
order to find that out, you can:

-Add some _log.debug statements to DbTable's constructor to see what
type the JDBC driver has reported for a column. Those types are ints,
having weird values like -2134 and such, so you'll have to look inside
the java.sql.Types source to compare and understand what type the weird
int corresponds to.

Hope this helps,

Aslak

----- Original Message -----
From: "Kasper Nielsen" <***@kav.dk>
Date: Wednesday, July 31, 2002 3:32 pm
Subject: [Middlegen-user] java.sql.Date vs java.sql.Timestamp
Post by Kasper Nielsen
Hi,
I have a table with a TIMESTAMP column, however middlegen
'translates' it
such that a java.sql.Date getter/setter is created.
Im sure I had a version once where this wasn't a problem.
- Kasper
-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Loading...