Play-2-6-ebeans-relationship-error

Posts Model

  /*set many to one relation with Privacy_Level model*/
  @ManyToOne//(fetch = FetchType.LAZY)
  @JoinColumn(name = "privacy_level_id",referencedColumnName = "id", insertable = false, updatable = false)
  public Privacy_Level privacy_level_t;

-------------------------------------------------------------------------------------------------------------
  Privacy_Level Model

  /*set one to many relation with Posts model*/
  @OneToMany(mappedBy = "privacy_level_t")
  public List<Posts> posts;

  /*set many to one relation with Table_Status model*/
  @ManyToOne
  @JoinColumn(name = "status",referencedColumnName = "id", insertable = false, updatable = false)
  public Table_Status table_status;
--------------------------------------------------------------------------------------------------------------
  Table_Status Model

  /*set many to one relation with Privacy_level table*/
  @OneToMany(mappedBy = "table_status")
  public List<Privacy_Level> privacy_level;

I have linked the Posts model with the Privacy_Level model using a manytoone/onetomany relationship while the Table_Status model with Privacy_Level model using a many to one/one to many relationship as well.

Now I need to access a value in Table_Status through a Posts object as shown below:

post.privacy_level_t.table_status.getDes() 

This worked fine in Play 2.5 but after migrating to Play 2.6 this returns a null value. I can however access a Privacy_Level value using post.privacy_level_t.getDes() but trying to access a value one step further down the hierarchy line returns an error.

I checked through the Play migration guide but could not find anything related to this issue.
Full post on StackOverFlow: https://stackoverflow.com/questions/50962499/play-2-6-ebeans-relationship-error

Hi @hasitha-c,

This may be a problem with Ebean. You can confirm that by creating a small project that only uses Ebean (no a Play project, just a regular Java project). If it didn’t work, then it is possible the newer version of Ebean used by play-ebean has a regression. If it works, then we can investigate it to see what is happening.

Best.

Hi,
Changing the sbt-play-ebean version from 4.1.3 to 4.1 resolved the issue!
Thanks for the feedback!