Records -- Using them as JPA entities and validating them with Bean Validation
Remi Forax
forax at univ-mlv.fr
Tue Apr 10 17:34:35 UTC 2018
No, not right for me,
a new Annotation target is better so each framework can decide what it means for its annotation.
It will slow the adoption but it's better in the long term.
Rémi
----- Mail original -----
> De: "Kevin Bourrillion" <kevinb at google.com>
> À: "Gunnar Morling" <gunnar at hibernate.org>
> Cc: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Mardi 10 Avril 2018 19:25:57
> Objet: Re: Records -- Using them as JPA entities and validating them with Bean Validation
> On Mon, Apr 9, 2018 at 1:39 PM, Gunnar Morling <gunnar at hibernate.org> wrote:
>
>>
>> * Annotation semantics: I couldn't find any example of records with
>> annotations, but IIUC, something like
>>
>> @Entity record Book(@Id long id, String isbn) { ... }
>>
>> would desugar into
>>
>> class @Entity public class Book { private @Id long id, private
>> String isbn; ... };
>>
>> For the JPA entity use case it'd be helpful to have an option to lift
>> annotations to the corresponding getters instead of the fields (as the
>> location of the @Id annotation controls the default strategy -- field vs.
>> property -- for reading/writing entity state). Similarly, Bean Validation
>> would benefit from such option.
>>
>
> My assumption has been that we would allow an annotation on a record
> parameter as long as it has *any of *{FIELD,METHOD,PARAMETER} as target,
> and that the annotation would be automatically propagated to each
> synthesized element it applies to. Does this sound about right to everyone?
>
>
> --
> Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
More information about the amber-dev
mailing list