Good morning, I would like to know what these two notes on programming are for. ?
Is it better than a self-rated id of type int?
@GeneratedValue(generator ="system-uuid")
@GenericGenerator(name="system-uuid",strategy="uuid")
Good morning, I would like to know what these two notes on programming are for. ?
Is it better than a self-rated id of type int?
@GeneratedValue(generator ="system-uuid")
@GenericGenerator(name="system-uuid",strategy="uuid")
@GeneratedValue(generator ="system-uuid")
It is a Hibernate annotation to indicate the strategy of generating the ID values of the table. Therefore it is used on the property of the class that corresponds to the key field of the table. You are using the generator system-uuid
@GenericGenerator(name="system-uuid",strategy="uuid")
Indicates that you are using predefined ID generator in the system or by the user: in this case the uuid strategy is defined by the system. You must give it a name so you can use it. In this case you use it with the annotation GeneratedValue
.
So in summary with these two annotations generate IDs type UUID