特定のIDでデータを取得したいだけです。クエリを含む私のメソッドは次のとおりです。
public static List getidProducts(Integer id) {
List<Products> productsid = Products.find("product_id IN:id").bind("id", id).fetch();
return productsid;
}
エラーが発生しています:シンボルが見つかりません。これは、エラーがメソッドfind()にあることを示しています。どこが間違っていますか?Plsは私に提案します。
ここに私のproducts.javaがあります
package models;
import java.util.*;
import javax.persistence.*;
import play.db.ebean.*;
import play.data.format.*;
import play.data.validation.*;
import com.avaje.ebean.*;
import java.sql.*;
public class Products extends Model {
@Id
public Integer product_id;
@Constraints.Required
public String productname;
@Constraints.Required
public Integer quantity;
@Constraints.Required
public Integer price;
public static Finder<Integer,Products> find = new Finder<Integer,Products>(Integer.class, Products.class);
public static List getidProducts(Integer id) {
return Products.find().where().in("id", id).findList();
}
}