I tried that out and it seemed to do exactly what I wanted. I noticed from reading the code that there is a <types/> element where I can just match "datetime" and not specific fields names. This option doesn't seem to be documented. Is there some reason its not documented? Should I not use this feature?
Darren On Thu, Nov 21, 2013 at 3:27 AM, Lukas Eder <[email protected]> wrote: > Hi Darren, > > 2013/11/21 Darren S <[email protected]> > >> I think it would be nice if there was an option in the code generator to >> define the setter/getters as java.util.Date and not >> java.sql.Date/Timestamp. I know their is a difference in the objects and I >> would expect that when fetching a record, the implementation of the >> java.util.Date value would be one of the java.sql.X ones. I think it would >> just be nice to do setMyField(new Date()). >> > > Have you seen the manual's section about Converters: > > http://www.jooq.org/doc/3.2/manual/sql-execution/fetching/data-type-conversion/ > > ... and how to enforce them to the code generator: > http://www.jooq.org/doc/3.2/manual/code-generation/custom-data-types/ > > With jOOQ 3.2, you can just rewrite all SQL DATE, TIME, TIMESTAMP types to > use your own custom Converter<T, java.util.Date>. Before, you could only > explicitly pattern-match column names, not data types > > >> I started looking at the code generator and seeing if this was an easy >> change. It works fine for the pojos, but then fails for the DAOs and >> Records. I found I ran into an issue with the DataType object. So would >> this even be possible, or would this seem like it would go against the core >> design/principles of jOOQ? I assume that supporting this in the pojos >> might be easy, but I was curious if this would be possible with the records >> too. >> > > Yes, it would be against jOOQ's design principles to introduce native > support for such "custom" data types, even if they're part of the JDK > (java.util.Date? java.util.Calendar? JodaTime? etc...). But I think the > above features should cover all of your needs. > > Cheers > Lukas > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "jOOQ User Group" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/jooq-user/VExjfjh942g/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
