spring boot generate id code example

Example: id auto generated jpa

@Entityjavax.persistence.EntityJPA annotationSpecifies that the class is an entity.See JavaDoc Reference Page...
public class EntityWithAutoId1 {
    @Idjavax.persistence.IdJPA annotationSpecifies the primary key of an entity.See JavaDoc Reference Page... @GeneratedValuejavax.persistence.GeneratedValueJPA annotationProvides for the specification of generation strategies for the
 values of primary keys.See JavaDoc Reference Page...(strategyGeneratedValue.strategyannotation element(Optional) The primary key generation strategy
 that the persistence provider must use to
 generate the annotated entity primary key.See JavaDoc Reference Page...=GenerationTypejavax.persistence.GenerationTypeJPA enumDefines the types of primary key generation strategies.See JavaDoc Reference Page....AUTOGenerationType.AUTOenum constantIndicates that the persistence provider should pick an 
 appropriate strategy for the particular database.See JavaDoc Reference Page...) long id;
     :
}

Tags:

Misc Example