Playframework – cause: javax persistence. Entitynotfoundexception: bean deleted – deferred load failed

Edit: additional information:

play.api.Application$$anon$1: Execution exception[[EntityNotFoundException: Bean has been deleted - lazy loading Failed]]
2015-11-23T04:48:23.432891+00:00 app[web.1]:    at play.api.Application$class.handleError(Application.scala:296) ~[com.typesafe.play.play_2.10-2.3.7.jar:2.3.7]
 2015-11-23T04:48:23.432891+00:00 app[web.1]:   at play.api.DefaultApplication.handleError(Application.scala:402) [com.typesafe.play.play_2.10-2.3.7.jar:2.3.7]
2015-11-23T04:48:23.432893+00:00 app[web.1]:    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [com.typesafe.play.play_2.10-2.3.7.jar:2.3.7]
2015-11-23T04:48:23.432894+00:00 app[web.1]:    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [com.typesafe.play.play_2.10-2.3.7.jar:2.3.7]
2015-11-23T04:48:23.432895+00:00 app[web.1]:    at scala.Option.map(Option.scala:145) [org.scala-lang.scala-library-2.10.4.jar:na]
2015-11-23T04:48:23.432896+00:00 app[web.1]: Caused by: javax.persistence.EntityNotFoundException: Bean has been deleted - lazy loading Failed
2015-11-23T04:48:23.432897+00:00 app[web.1]:    at com.avaje.ebean.bean.EntityBeanIntercept.loadBeanInternal(EntityBeanIntercept.java:516) ~[org.avaje.ebeanorm.avaje-ebeanorm-3.3.4.jar:na]
2015-11-23T04:48:23.432898+00:00 app[web.1]:    at com.avaje.ebean.bean.EntityBeanIntercept.loadBean(EntityBeanIntercept.java:480) ~[org.avaje.ebeanorm.avaje-ebeanorm-3.3.4.jar:na]
2015-11-23T04:48:23.432899+00:00 app[web.1]:    at com.avaje.ebean.bean.EntityBeanIntercept.preGetter(EntityBeanIntercept.java:583) ~[org.avaje.ebeanorm.avaje-ebeanorm-3.3.4.jar:na]
2015-11-23T04:48:23.432899+00:00 app[web.1]:    at models.Album._ebean_get_artist(Album.java:4)
2015-11-23T04:48:23.432900+00:00 app[web.1]:    at models.Album.getArtist(Album.java)

Edit: added part of album definition:

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;
@Column(length = 254)
@Constraints.MaxLength(254)
@NotNull
public String name;
@Column(name = "fullname",length = 254)
@Constraints.MaxLength(254)
@NotNull
public String fullName;
public Integer year;
@ManyToOne
@JoinColumn(name = "artist")
public Artist artist;
@OneToMany(fetch = FetchType.EAGER,mappedBy = "album")
@OrderBy("name asc")
public List<Song> songs = Lists.newArrayList();
@OneToMany(fetch = FetchType.EAGER,mappedBy = "originalAlbum")
@OrderBy("name asc")
public List<Song> covers = Lists.newArrayList();

I've seen entitynotfoundexception: bean has been deleted – lazy loading failed

There must be some corrupted data somewhere However, because the model I'm using is very complex, I don't know where to start debugging

Do you have a tip? (play framework 2.3, avaje ebean 3.1.1) upgrading to play framework 2.4 is still the same problem

Solution

Here is the process I used to find the root cause of ORM problems:

>Identify entities expressed in symptoms; > Identify entities related to entities expressed in symptoms (ies); > Identify related entity (or) models; > Identifying the data storage entity (ies) model; And, > coordinate entities, ORM and data models

Map this process to your question:

>In the stack trace, we see that album is represented in the symptom (that is, your stack trace); > Check the entity definition of the album to identify the relevant entities; > For each relevant entity, determine the representation of your ebean ORM model; > For each of these entities, identify the SQL model; And, > from these data, reconcile differences.

As pointed out in the comments, you are likely to encounter ORM errors If possible, even if you can't do this in production, it may be worth the time to upgrade to the latest stable versions of play and ebean

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>