You have a table in a database based on the following class (the table's name and fields are the same):
Java
@Entity
public class Product {
@Id
@GeneratedValue
private long id;
private String model;
private String type;
private int price;
// constructor, getters, setters
}
Kotlin
@Entity
data class Product(
@Id
@GeneratedValue
val id: Long = 0,
val model: String? = null,
val type: String? = null,
val price: Int = 0
)
You want to fetch the products of a certain model from the database and then page them. Which methods do you need to do it?
Java
-
Page<Product> findAll(String model, Pageable pageable); -
Page<Product> findByModel(Pageable pageable, String model); -
Page<Product> findByModel(String model, Pageable pageable); -
List<Product> findByModel(String model, Pageable pageable); -
Page<Product> findByModel(Pageable pageable);
Kotlin
-
fun findAll(model: String, pageable: Pageable): Page<Product> -
fun findByModel(pageable: Pageable, model: String): Page<Product> -
fun findByModel(model: String, pageable: Pageable): Page<Product> -
fun findByModel(model: String, pageable: Pageable): List<Product> -
fun findByModel(pageable: Pageable): Page<Product>