jakartaee / jakartaee/persistence

YearMonth and MonthDay from java.time

Open
#729 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
267
Forks
78
Avg merge
1d 6h
Merged PRs (30d)
13

Description

A specification participant in Jakarta Data proposed adding [java.time.YearMonth](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/YearMonth.html) and [java.time.MonthDay](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/MonthDay.html) 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](https://jakarta.ee/specifications/persistence/3.2/jakarta-persistence-spec-3.2#a486) or elsewhere in the spec

Contributor guide

Open the contributing guide

Research direction

Start with the Jakarta Persistence 3.2 Basic Types section and the linked java.time.YearMonth and MonthDay API references. Determine how the specification should define sortable database representations and supported EXTRACT fields, then update the relevant persistence specification text and verify both types are listed as supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.