javax.persistence.Entity生成NullPoint异常

时间:2013-02-08 19:45:52

标签: java hibernate jpa playframework playframework-2.0

我在Play框架2.0.4中使用Hibernate for ORM。我有一个名为video的模型类,使用JPA进行注释。但是,当我运行应用程序时,我收到以下错误

   [NullPointerException: null] In C:\Users\username\IdeaProjects\projectname\app\models\Video.java at line 4.

 1package models;

2

3 import java.util.Date;
4 import javax.persistence.Entity;
5 import javax.persistence.Id;
6
7@Entity
8public class Video {

我刚刚开始学习游戏,并且没有一个线索是什么导致了这个问题以及如何解决它。 堆栈跟踪        ! @ 6d9h9310f - 内部服务器错误,请求[GET /] - >

  play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NullPo
  interException: null]]
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [
  play_2.9.1.jar:2.0.4]
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [
 play_2.9.1.jar:2.0.4]
    at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
    at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.
 4]
    at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.
  2]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.j
   ar:2.0.2]
 Caused by: java.lang.NullPointerException: null
    at models.Video._ebean_get_video_name(Video.java:4) ~[classes/:na]
    at models.Video.getVideoName(Video.java:43) ~[classes/:na]
    at controllers.Application.index(Application.java:15) ~[classes/:2.0.4]
    at Routes$$anonfun$routes$1$$anonfun$apply$1$$anonfun$apply$2.apply(rout
 es_routing.scala:32) ~[classes/:na]
    at Routes$$anonfun$routes$1$$anonfun$apply$1$$anonfun$apply$2.apply(rout
  es_routing.scala:32) ~[classes/:na]
    at play.core.Router$HandlerInvoker$$anon$5$$anon$1.invocation(Router.sca

我意识到那时我只是为视频实体调用主键我没有问题但是当我试图获得任何其他属性时会发生这种情况。我也意识到在我的数据库中生成了一个名为_ebean_intercept的新列,它的所有行都为null,这可能导致问题。

0 个答案:

没有答案