Skip to content

Commit

Permalink
Creating Repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
fawad1997 committed Apr 15, 2020
1 parent 1769980 commit 6c1d0b6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@ Now create an entity **Country**, annotate class with annotations **@Entity**, *

<code>List<.City> cities</code> and annotate it with **@OneToMany(cascade = CascadeType.ALL)** and **@JoinColumn(name = "cc_fk",referencedColumnName = "countryId")**. Yhis will create cc_fk column in City table and make it foreign key.


##### Creating Repositories
same as above
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.restfulspring.apiexample.repository;

import com.restfulspring.apiexample.entity.City;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface CityRepository extends JpaRepository<City,Integer> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.restfulspring.apiexample.repository;

import com.restfulspring.apiexample.entity.Country;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface CountryRepository extends JpaRepository<Country,Integer> {

}

0 comments on commit 6c1d0b6

Please sign in to comment.