Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Andras Madi-Szabo
Added: May 19, 2020 11:18 AM
Views: 6
Tags: beci vizsga
  1. import com.example.demo.models.User;
  2. import java.util.List;
  3. import org.springframework.data.jpa.repository.Query;
  4. import org.springframework.data.repository.CrudRepository;
  5. import org.springframework.stereotype.Repository;
  6.  
  7. public interface UserRepository extends CrudRepository<User, Long> {
  8.  
  9.   @Query(value = "SELECT * FROM users WHERE age > :age", nativeQuery = true)
  10.   List<User> findAllByAgeGreaterThan(int age);
  11.  
  12.   List<User> findAll();
  13. }
  14.