@gsmet , I'd certainly be willing to write this, but I am not sure what SQL type it should map to. For both Year and YearMonth no actual SQL type exists (at least for my known dialects). Whilst it is conventional to map these to a SQL date (either the first day of the year or the first day of the month respectively) because it is easy and makes it possible to do comparisons against other date formats (i.e. check whether a date lies within a year), it is also maybe for some use cases unexpected. I.e. people that want to map a year to an integer value instead. Because no logical SQL equivalent exist, I think this is best done through the means of custom types or attribute converters specific to the domain. Nevertheless, if everyone's onboard for a type provided by Hibernate that treats these as dates, I can certainly do so, in fact, I already have such a type implementation lying around. |