As a ...
I need to be able to ...
write a portable repository backed by JPA.
Which enables me to ...
be more independent of the Jakarta Data provider.
Additional information
So I know we all said we didn't want to do this in this release. But with all the machinery we've defined, it's now frankly trivial.
We would add:
- lifecycle annotations
@Persist, @Merge, @Refresh, @Lock, @Remove, and @Detach, and
- query annotations
@JPQL and I guess also @SQL
in new package jakarta.data.orm.
The semantics of the lifecycle annotations are completely defined by the JPA spec. Because they're specific to JPA/ORM, we have zero work to do, it's just a @see annotation that points to the corresponding operation of EntityManager.
It's similarly clear what @JPQL does. On the other hand, perhaps we don't need it and all we need to do is give people explicit permission to put their JPQL in the @Query annotation. (I can see arguments both ways.)
Finally, if I recall correctly, at some stage someone (Otavio I guess) had proposed a built-in JpaRepository. I don't argue that we need it, but if you all still want it, it's completely trivial to define in terms of the annotations listed above.
So why is this now so easy when previously it was "hard". Well, before, we were trying to shoehorn JPA into the existing @Save annotation or whatever. But now that our model of lifecycle annotations is extensible, it's no longer hard.
Dunno. I guess I feel like it's now become a bit hard to justify not doing it.
Reactions?
As a ...
I need to be able to ...
write a portable repository backed by JPA.
Which enables me to ...
be more independent of the Jakarta Data provider.
Additional information
So I know we all said we didn't want to do this in this release. But with all the machinery we've defined, it's now frankly trivial.
We would add:
@Persist,@Merge,@Refresh,@Lock,@Remove, and@Detach, and@JPQLand I guess also@SQLin new package
jakarta.data.orm.The semantics of the lifecycle annotations are completely defined by the JPA spec. Because they're specific to JPA/ORM, we have zero work to do, it's just a
@seeannotation that points to the corresponding operation ofEntityManager.It's similarly clear what
@JPQLdoes. On the other hand, perhaps we don't need it and all we need to do is give people explicit permission to put their JPQL in the@Queryannotation. (I can see arguments both ways.)Finally, if I recall correctly, at some stage someone (Otavio I guess) had proposed a built-in
JpaRepository. I don't argue that we need it, but if you all still want it, it's completely trivial to define in terms of the annotations listed above.So why is this now so easy when previously it was "hard". Well, before, we were trying to shoehorn JPA into the existing
@Saveannotation or whatever. But now that our model of lifecycle annotations is extensible, it's no longer hard.Dunno. I guess I feel like it's now become a bit hard to justify not doing it.
Reactions?