The Artima Developer Community
Sponsored Link

Java Buzz Forum
dont use SQL Date or use ORM

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Marc Logemann

Posts: 594
Nickname: loge
Registered: Sep, 2002

Marc Logemann is founder of www.logentis.de a Java consultancy
dont use SQL Date or use ORM Posted: Sep 27, 2006 6:53 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Marc Logemann.
Original Post: dont use SQL Date or use ORM
Feed Title: Logemann Blog
Feed URL: http://www.logemann.org/blojsom/blog/default/?flavor=rss2
Feed Description: Marc's thoughts on Java and more
Latest Java Buzz Posts
Latest Java Buzz Posts by Marc Logemann
Latest Posts From Logemann Blog

Advertisement

Its amazing how many companies still write plain JDBC code and use advanced column types like Date. Its really a pain to make an application cross-database when you are in this mode. Either you end up writing case statements all over the time asking the connection what vendor it is, or you are trying to use JDBC escapes like "ts" or "d".

But then you will realize that even JDBC escapes are a pain, because if you want to supply a complete Date into a Date field, you will see that "d" doesnt catch it because its only the date, not the time. Then you will use "ts" and will be lucky that this works in Oracle. Now when you want to test your code using Derby for instance, you will notice that Derby doesnt convert "ts" to a Date column but only to a timestamp column. Of course you really dont want to create a different DDL for Derby than for your production DB.

This all boils down to DONT USE DATE AT ALL. Why not just using an integer holding a unix timestamp? And if you cant resist using Date. Then in gods name use an ORM layer.

Read: dont use SQL Date or use ORM

Topic: Mobile Confusion among an Indy Domain Name Speculator Start-Up Previous Topic   Next Topic Topic: Java Utility To Touch Files

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use