Package org.hibernate.search.test.performance.task

Source Code of org.hibernate.search.test.performance.task.UpdateBookTotalSoldTask

/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.test.performance.task;

import org.hibernate.search.FullTextSession;
import org.hibernate.search.test.performance.model.Book;
import org.hibernate.search.test.performance.scenario.TestContext;

/**
* @author Tomas Hradec
*/
public class UpdateBookTotalSoldTask extends AbstractTask {

  public UpdateBookTotalSoldTask(TestContext ctx) {
    super( ctx );
  }

  @Override
  protected void execute(FullTextSession fts) {
    long bookId = ctx.getRandomBookId();
    Book book = (Book) fts.get( Book.class, bookId );
    if ( book != null ) {
      book.setTotalSold( book.getTotalSold() + 1 );
    }
  }

}
TOP

Related Classes of org.hibernate.search.test.performance.task.UpdateBookTotalSoldTask

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.