jakartaee / jakartaee/persistence

support SQL arrays

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

Description

Both Hibernate and EclipseLink have an `@Array` annotation for mapping Java arrays to SQL `array` types.

I therefore think we should add the following annotation to JPA:

```java
@Target({FIELD, METHOD})
@Retention( RUNTIME )
public @interface Array {
/**
* The maximum length of the array.
*/
int length();
}
```

You could use it like this:

```java
@Array(length=10)
String[] tags;
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how JPA currently represents database array types and how Hibernate and EclipseLink expose their @Array annotations. Define the required JPA mapping behavior and integration points, then verify that the proposed annotation supports the shown String[] example and has compatible specification coverage.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.