What is Long here and what on basis do we configure this in JpaRepository?
public interface FirstRepository extends JpaRepository<First, Long> {
}
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With