persistence icon indicating copy to clipboard operation
persistence copied to clipboard

YearMonth and MonthDay from java.time

Open njr-11 opened this issue 7 months ago • 2 comments

A specification participant in Jakarta Data proposed adding java.time.YearMonth and java.time.MonthDay as supported temporal types in Jakarta Data. The participant also indicated having a business need for YearMonth. I noticed that as of Jakarta Persistence 3.2, there is no support for these temporal types, so for now we had to decline adding support for them to Jakarta Data. It was decided I would open this issue to ask about getting them supported in Jakarta Persistence.

In order for them to be supported by Jakarta Data, Jakarta Persistence would need to

  • define representation in the database for java.time.YearMonth and java.time.MonthDay that makes values comparable and sortable in a meaningful way (which for YearMonth would be year first then month, and for MonthDay would be month first then day as if all were in the same year)
  • support EXTRACT of YEAR and MONTH for YearMonth, and EXTRACT of MONTH and DAY for MonthDay (and I suppose QUARTER would also make sense for both).
  • list as supported types under Basic Types or elsewhere in the spec

njr-11 avatar Jun 04 '25 14:06 njr-11