I'm fairly new to Hibernate. I want to map some object, let's say String to a mysql date (which is a date without time or timezone). I thought this would be fairly straight forward. But I can't seem to find a good solution.
In my actual app, I'm not using a String. I want to use something like LocalDate in JSR 310 or my own simple month-date-year triplet type.
I really... really don't want to write some internal setter or getter which translates my simple object into a java.sql.Date or java.util.Date because:
- It bloats the domain object with unnecessary code.
- I'd have to write the same code in all my domain objects
- It sort of defeats the whole purpose of me using this type of class. The whole point of using these classes is to avoid any possible timezone issues. It seems really stupid to introduce a class (java.sql.Date or java.util.Date) which has time and timezone when I only want to persist a simple date (like a birthday date - October 1, 2005).
I suppose the underlying problem is the JDBC driver might only be able to map the core java Date classes to the mysql date types???