Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Playframework 在ebean数据库中存储textarea内容_Playframework_Playframework 2.0_Ebean - Fatal编程技术网

Playframework 在ebean数据库中存储textarea内容

Playframework 在ebean数据库中存储textarea内容,playframework,playframework-2.0,ebean,Playframework,Playframework 2.0,Ebean,我认为这个问题可能有点愚蠢——我正在做我的第一个Play项目,因此我仍在努力获得对软件的概述;) 嗯,我有一个包含文本区域的页面。用户应该能够在那里输入文本,并将其永久存储在标准ebean数据库中。 但是存储从来都不起作用,我也找不出原因 这是数据库对象的类定义: public class Entry extends Model { @Required public String text; public String studentName; @I

我认为这个问题可能有点愚蠢——我正在做我的第一个Play项目,因此我仍在努力获得对软件的概述;)

嗯,我有一个包含文本区域的页面。用户应该能够在那里输入文本,并将其永久存储在标准ebean数据库中。 但是存储从来都不起作用,我也找不出原因

这是数据库对象的类定义:

public class Entry extends Model {
    @Required
    public String   text;   
    public String   studentName;
    @Id
    public long     id;
    public static   Finder<Long, Entry> finder = new Finder<Long, Entry>( Long.class, Entry.class);

    public static Entry getMe(Long id) {
        return finder.byId(id);
    }
    public static void saveMe(Entry toDataBase) {
        toDataBase.save();
    }
    // ....
 }
公共类条目扩展模型{
@必需的
公共字符串文本;
公共字符串studentName;
@身份证
公共长id;
公共静态查找器=新查找器(Long.class、Entry.class);
公共静态条目getMe(长id){
返回finder.byId(id);
}
公共静态void saveMe(数据库条目){
toDataBase.save();
}
// ....
}
以下是文本区域:

@(entryForm: Form[Entry])
@import helper._
@main("xy") {

<h1>report for @entryForm("studentName")</h1>

    @form(routes.Application.storeReport()) {
        @textarea(entryForm("report:"))
        <input type="submit" value="Store Report">
    }
}
@(entryForm:Form[Entry])
@导入助手_
@主(“xy”){
@entryForm(“学生姓名”)的报告
@表单(routes.Application.storeReport()){
@文本区域(入口形式(“报告:”)
}
}
应用程序中,storeReport()
方法entryForm.bindFromRequest().hasrerrors()始终为true

@textarea(entryForm(“report:”)
更改为
@textarea(entryForm(“text”))
(…告诉你,我实际上要填充3个输入字段中的哪一个)甚至会导致PersistenceException:

“类型[class models.Entry]不是已注册的实体?如果您没有明确列出要使用的实体类,Ebean将在类路径中搜索它们。如果实体在Jar中,请检查Ebean.properties文件中的Ebean.search.jars属性或检查ServerConfig.addJar()。]”


在上定向,除了让它扩展play.db.ebean.Model外,我无法检测到如何注册一个完整的else

我认为您忘记了Entry类上的@Entity注释