Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.springframework.data.jpa.repository.JpaRepository;
- public interface FacilityRepository extends JpaRepository<Facility, Long> {
- }
- public interface FacilityService {
- public Facility create(Facility facility);
- }
- @Service
- public class FacilityServiceImpl implements FacilityService {
- @Resource
- private FacilityRepository countryRepository;
- @Transactional
- public Facility create(Facility facility) {
- Facility created = facility;
- return facilityRepository.save(created);
- }
- }
- interface ProductRepository<T extends Product> extends CrudRepository<T, Long> {
- @Query("select p from #{#entityName} p where ?1 member of p.categories")
- Iterable<T> findByCategory(String category);
- Iterable<T> findByName(String name);
- }
- class MyClient {
- @Autowired
- public MyClient(ProductRepository<Car> carRepository,
- ProductRepository<Wine> wineRepository) { … }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement