jakartaee / jakartaee/persistence
Proposal for new @View annotation
- Dominant language
- Java
- Stars
- 268
- Forks
- 78
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 13
Description
Although RDBMS **Views** can be mapped with the JPA `@Table` annotation currently, it would be helpful to have a specific annotation for that, `@View`, that can be meaningful in a declarative way to a Developer reading the codebase. Structurally it would behave just like a `@Table` and it could even be defined as one, for example:
```
@Target(TYPE)
@Retention(RUNTIME)
@Table
public @interface View {
//..
}
```
Both annotations would be interchangeable just like today the `@Table` annotation can be used for both a Table and a View.
That would mean a definition such as this one: `@View(name = "table_name_here")` would be possible and it would be the Developer's responsibility to use it correctly since the whole purpose if it is to facilitate Developers reading the declaration of entities in the codebase.
Happy to provide the annotation definition if this proposal gets considered.
Contributor guide
Research direction
Start by reviewing the proposal's relationship between the JPA @Table annotation and the suggested @View annotation. Define what interchangeability and declarative use should mean, then confirm that the resulting annotation design meets the stated goal for mapping database views.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100