'Meaning of Long in JPARepository?

What is Long here and what on basis do we configure this in JpaRepository?

public interface FirstRepository extends JpaRepository<First, Long> {
}


Solution 1:[1]

Long is data type of Primary key (RDBMS) or autogenerated unique document Id(Mongo DB).

public interface FirstRepository extends JpaRepository<EntityName,DataType_of_primaryKey> {

}

Ex: If your Entity is like that:

class Person{
   Long id;
   String name;
}
public interface FirstRepository extends JpaRepository<Person,Long> {
}

Exmplanation

Person -> Entity

id -> Primary key for Person object(Data type should be long)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Karthikeyan