renatsaf opened a new pull request, #9448:
URL: https://github.com/apache/netbeans/pull/9448

   ## What
   
   The **Entity Classes from Database** wizard always mapped temporal columns 
(`DATE`/`TIME`/`TIMESTAMP`) to `java.util.Date` with a `@Temporal` annotation, 
forcing users to refactor the generated entities by hand.
   
   This adds a **Date/Time API** mapping option, sitting next to the existing 
*Collection Type* option (the UI pattern requested in the issue), letting the 
user choose `java.time` types instead:
   
   | SQL column | `java.time` |
   |---|---|
   | `java.sql.Date` | `java.time.LocalDate` |
   | `java.sql.Time` | `java.time.LocalTime` |
   | `java.sql.Timestamp` | `java.time.LocalDateTime` |
   
   `java.time` types are mapped natively by JPA 2.2+, so **no** `@Temporal` 
annotation is emitted for them.
   
   The default remains `java.util.Date`, so existing behavior is unchanged 
unless the user opts in.
   
   ## How
   
   - New `DateTimeType` enum (`LEGACY` / `JAVA_8`) in the `entitygenerator` 
package.
   - `RelatedCMPHelper` carries the choice; `MappingOptionsPanel` exposes the 
combo box and wires it through `readSettings`/`storeSettings`, mirroring 
`CollectionType`.
   - `JavaPersistenceGenerator.getMemberType()` / `getMemberTemporalType()` 
branch on the selected family; `@Temporal` is suppressed for `java.time`.
   - Help page (`f1_jpa005.htm`) documents the new option.
   
   ## Test
   
   - Existing `JPAGenTest` cases updated for the new parameter.
   - New `JPAGenTest.testGenerateJavaTimeTypes` generates an entity with 
`DATE`/`TIME`/`TIMESTAMP` columns under `JAVA_8` and asserts the generated 
source uses the `java.time` types and contains no `java.util.Date` or 
`@Temporal`.
   
   Fixes #3755
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to