Jpa 玩框架1.2.3模型不由任何插件管理
我在玩!1.2.3 我试图从yaml文件加载数据并使用JPA将其持久化,但遇到了一个异常 执行异常 发生运行时异常:无法加载装置rss-sources.yml:Model models.RSSSource不由任何插件管理 有人能提供建议吗 堆栈跟踪为Jpa 玩框架1.2.3模型不由任何插件管理,jpa,playframework,playframework-1.x,Jpa,Playframework,Playframework 1.x,我在玩!1.2.3 我试图从yaml文件加载数据并使用JPA将其持久化,但遇到了一个异常 执行异常 发生运行时异常:无法加载装置rss-sources.yml:Model models.RSSSource不由任何插件管理 有人能提供建议吗 堆栈跟踪为 Internal Server Error (500) for request GET / Execution exception (In /app/controllers/Bootstrap.java around line 19) Runti
Internal Server Error (500) for request GET /
Execution exception (In /app/controllers/Bootstrap.java around line 19)
RuntimeException occured : Cannot load fixture rss-sources.yml: Model models.RSSSource is not managed by any plugin
play.exceptions.JavaExecutionException: Cannot load fixture rss-sources.yml: Model models.RSSSource is not managed by any plugin
at play.jobs.Job.call(Job.java:155)
at Invocation.Job(Play!)
Caused by: java.lang.RuntimeException: Cannot load fixture rss-sources.yml: Model models.RSSSource is not managed by any plugin
at play.test.Fixtures.loadModels(Fixtures.java:223)
at controllers.Bootstrap.doJob(Bootstrap.java:19)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
... 1 more
Caused by: play.exceptions.UnexpectedException: Model models.RSSSource is not managed by any plugin
at play.db.Model$Manager.factoryFor(Model.java:57)
at play.test.Fixtures.resolveDependencies(Fixtures.java:386)
at play.test.Fixtures.loadModels(Fixtures.java:197)
... 4 more
我的模范班是:
package models;
import javax.persistence.*;
import play.db.jpa.*;
import play.data.validation.*;
import org.yaml.snakeyaml.Yaml;
/**
* Class to describe a news url
* contains url string and category
*
*
*
*/
@Entity
@Table(name="RSSSourcesTable")
public class RSSSource
{
//variable to old source
@Required
@Id
private String source;
//variables to hold urls for news category RSS feeds
private String topNewsURL;
private String worldNewsURL;
private String ukNewsURL;
private String usaNewsURL;
private String sportsNewsURL;
private String businessNewsURL;
private String technologyNewsURL;
public RSSSource(String source)
{
this.source = source;
}
//getters and setters here
}
我的引导类是:
package controllers;
import play.jobs.Job;
import play.jobs.OnApplicationStart;
import play.jobs.OnApplicationStop;
import play.test.Fixtures;
@OnApplicationStart
public class Bootstrap extends Job
{
/**
* On start up this method loads the configuration that is set in the config loader, this contains the connection details for the
* RSS feed sources.
*
*/
public void doJob()
{
System.out.println("Loading RSS sources from file: rss-sources.yml");
Fixtures.loadModels("rss-sources.yml");
}
}
您的模型类应该扩展
play.db.jpa.model
,或者,在您的情况下,由于您使用的是自定义ID,play.db.jpa.GenericModel
()。即
应该成为
public class RSSSource extends GenericModel
顺便说一下,您可能希望从Play 1.2.3更新到1.2.5。您的模型类应该扩展
Play.db.jpa.model
,或者,在您的情况下,由于您使用的是自定义ID,Play.db.jpa.GenericModel
()。即
应该成为
public class RSSSource extends GenericModel
顺便说一句,您可能需要从Play 1.2.3更新到Play 1.2.5