播放框架ebean找不到符号类:@Entity

时间:2019-03-03 14:31:41

标签: playframework ebean

当前正在尝试在play框架上建立ebean数据库,但似乎无法正常工作,下面是发生的问题以及我的代码的图像。完全不确定是什么问题,尝试了我能想到的一切,但还是没有运气。

This is the error im getting

对此将提供任何帮助!

这是我的代码:

package models;

import java.util.*;
import javax.persistence.Id;

import io.ebean.*;
import play.data.format.*;
import play.data.validation.*;

@Entity
public class Product extends Model{

    // Properties

    private Long id;  

    private String make;     

    private String model; 

    private int year;

    private String fuelType;

    @Constraints.Min(0)
    private int price;

    private String colour;

    // Default Constructor
    public Product() {     

    }

    // Contructor to initialise object
    public  Product(Long id, String make, String model, int year, String fuelType, int price, String colour) {
        this.id = id;
        this.make = make;
        this.model = model;
        this.year = year;
        this.fuelType = fuelType;
        this.price = price;
        this.colour = colour;
    }

    public static Finder<Long,Product> find = new Finder<>(Product.class);

    // Accessor methods
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }

    public String getMake() {
        return make;
    }
    public void setMake(String make) {
        this.make = make;
    }

    public String getModel() {
        return model;
    }
    public void setModel(String model) {
        this.model = model;
    }

    public int getYear() {
        return year;
    }
    public void setYear(int year) {
        this.year = year;
    }

    public String getFuelType() {
        return fuelType;
    }
    public void setFuelType(String fuelType) {
        this.fuelType = fuelType;
    }

    public int getPrice() {
        return price;
    }
    public void setPrice(int price) {
        this.price = price;
    }

    public String getColour() {
        return colour;
    }
    public void setColour(String colour) {
        this.colour = colour;
    }
}

0 个答案:

没有答案