Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jparepository cannot be resolved to a type

I am trying to use JpaRepository but I am getting this error "jparepository cannot be resolved to a type."

My maven dependency is

` 4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.2.RELEASE com.example accessing-data-jpa 0.0.1-SNAPSHOT accessing-data-jpa Demo project for Spring Boot

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

`

My student class is

package Repositry;

public interface Student_Repo extends JpaRepositry  {

}

Please let me know what I have done wrong

like image 216
akash mahajan Avatar asked Feb 24 '26 15:02

akash mahajan


1 Answers

Typo here.

It is JpaRepository not JpaRepositry

Also it expects 2 parameters.

  1. Entity class

  2. Type of primary key field (Integer/Long)

Like below.

Student_Repo extends JpaRepository<Student,Long>
like image 130
Alien Avatar answered Feb 26 '26 03:02

Alien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!