I am storing values like names,password,username,email
in database and i want that an id
a primary column automatically created and it's value start with 1 and automatically increment . I am creating one class user
and it has data member like i write
@Entity
public class User extends Model {
@Id(start)
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
@Required
@MinLength(value=4)
public String username;
@Required
public String name;
@Required
@MinLength(value=6)
public String password;
@Required
@Email
public String email;
public User(String name,String username,String password,String email)
{
this.name=name;
this.username=username;
this.password=password;
this.email=email;
}
}
i am storing value in database and it is storing value and creating id column in database like this screenshot of database
In this screenshot it is creating random value and storing that value in id
column like 129 141 161 162
but i don't want this value i want that value will start with 1, 2,3
like this.
Please anyone have idea about which annotation i have to use for this that create column automatically and start value with 1? and How to do it ?
Give me some idea.