java - Need to select one row in table by Spring Data JPA in Spring mvc -
my table studetdetails (contain id,student_name,des) need value of studentname using springdatajpa.
my entity is:
@entity @table(name="student_details") public class studentdetails { @id @generatedvalue(strategy = generationtype.auto) @column(name = "id", nullable = false) private long id; @column(name = "student_name") private string studentname; }
my repository is:
public interface studentdetailsrepository extends jparepository<studentdetails, long>{ public list<studentdetails> findallbystudentname(); --------------------- }
findallbystudentname() 1 correct way???
service class is::::
@autowired studentdetailsrepository studetailsrepository; list<addinsurancedto> getstudentdetils(){ vendordetails = studetailsrepository.findallbystudentname(); }
i getting error:error creating bean name 'studentdetailsrepository': invocation of init method failed; nested exception java.util.nosuchelementexception
kindly please!!!
Comments
Post a Comment