user3536156
user3536156

Reputation: 33

play framework ebean: computer database java 2.4

I started my project from the computer database template (java) which is play version 2.3.7 but when I switch to 2.4.1 and ebean becomes a plugin I encounter the problem

In list.scala.html the com.avaje.ebean.Page doesn't get recognized anymore

@(currentPage: com.avaje.ebean.Page[Computer], currentSortBy: String, currentOrder: String, currentFilter: String)

Read from stdout: /home/school/Documents/projecten3/computer-database-java/app/views/list.scala.html:1: type Page is not a member of package com.avaje.ebean

Upvotes: 1

Views: 1050

Answers (2)

user3536156
user3536156

Reputation: 33

thanks biesior for pointing me in the right direction

for other people I would like to add what I changed

In Application.java I changed

computerForm.get().save(); // update method, I think update(id) is deprecated, or it has to do with transition from play.ebean to com.avaje.ebean

In Computer.java

    public static PagedList<Computer> page(int page, int pageSize, String sortBy, String order, String filter) {
    return 
        find.where()
            .ilike("name", "%" + filter + "%")
            .orderBy(sortBy + " " + order)
            .fetch("company")
            .findPagedList(page, pageSize);
}

make sure your models inherit from 'extends com.avaje.ebean'

Upvotes: 2

biesior
biesior

Reputation: 55798

Use this instead:

@(currentPage: com.avaje.ebean.PagedList[Computer])

<ul>
  @for(computer <- currentPage.getList){
    <li>@computer.name</li>
  }
</ul>

Here's the point where change occured: https://github.com/ebean-orm/avaje-ebeanorm/issues/96

Upvotes: 1

Related Questions