Skip to content

Commit

Permalink
added "findByName" method
Browse files Browse the repository at this point in the history
  • Loading branch information
Antt02 committed Mar 7, 2024
1 parent 0b3c6ea commit 4ba1cfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class Pet extends UriEntity<Long> {

@ManyToOne
public Shelter isIn;

@ManyToMany
public User[] favouritedBy;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package cat.udl.eps.softarch.demo.repository;

import cat.udl.eps.softarch.demo.domain.Pet;
import cat.udl.eps.softarch.demo.domain.User;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface PetRepository extends CrudRepository<Pet, Long>, PagingAndSortingRepository<Pet, Long> {
List<User> findBySize(@Param("size") String size);
//List<Shelter> findByShelter(@Param("Shelter") Shelter shelter);
List<Pet> findBySize(@Param("size") String size);
List<Pet> findByName(@Param("name") String name);
//Pet findByShelter(@Param("id") Long shelterId);

}

0 comments on commit 4ba1cfa

Please sign in to comment.