Hi.
When create a new JPA Entity the default values it’s:
I need to set the default values like this:
because I must create a hundred entities.
how can I do it?
Thanks in advance
Hi.
When create a new JPA Entity the default values it’s:
I need to set the default values like this:
because I must create a hundred entities.
how can I do it?
Thanks in advance
Hi,
In this case you should create a @MappedSuperclass
. In there you define the ID type as well as the traits that you want to have for all entities that extend this class. See here for an example (I called it MyStandardEntity
here):
When you create a new regular Entity, you use the Parent
drop down to select your custom mapped superclass. Then all the settings will be correctly set and can also not be changed as part of the wizard, as those are defined by the mapped superclass. See here for an example:
I hope this helps!
Cheers
Mario