This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

casting varchar to Date/Calendar ? (DB table is readonly!)

Will Zelan
Ranch Hand
Posts: 56
Flex Python Windows Vista
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had to create entity-classes for db tables which already existed and which I can only read but not modify.

One problem with those tables is their bad design...
For example, one columns type is varchar but it contains a date formatted like this: "2012-08-08 14:23:48"

Now I need to do a query which checks, that this date is before another date (my parameter). This means I need hibernate to handle the varchar column as a Date, Timestamp, Calendar or whatever object which can be used in a query for comparisons.

Is there any way to handle a varchar-columns as ad "real" date? Using annotations, casts, ...?

Any help is appreciated!
I agree. Here's the link:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic