Examples of BatchCallback


Examples of org.hibernate.search.test.performance.util.BatchCallback

    initDatabaseStopWatch.start();

    BatchSupport batchSupport = new BatchSupport( sf );
    batchSupport.execute( "insert into author(id, name) values(?, ?)", initialAutorCount,
        new BatchCallback() {
          @Override
          public void initStatement(PreparedStatement ps, long id) throws SQLException {
            ps.setLong( 1, id );
            ps.setString( 2, "autor" + id );
          }
        } );
    batchSupport.execute( "insert into book(id, title, summary, rating, totalSold, publicationDate) values(?, ?, ?, ?, ?, ?)", initialBookCount,
        new BatchCallback() {
          @Override
          public void initStatement(PreparedStatement ps, long id) throws SQLException {
            ps.setLong( 1, id );
            ps.setString( 2, "title" + id );
            ps.setString( 3, reverse( SUMMARIES[(int) ( id % SUMMARIES.length )] ) );
            ps.setLong( 4, -1 );
            ps.setLong( 5, -1 );
            ps.setDate( 6, new Date( PUBLICATION_DATE_ZERO.getTime() ) );
          }
        } );
    batchSupport.execute( "insert into book_author(book_id, authors_id) values(?, ?)", initialBookCount,
        new BatchCallback() {
          @Override
          public void initStatement(PreparedStatement ps, long id) throws SQLException {
            ps.setLong( 1, id );
            ps.setLong( 2, initialOffset + ( id % initialAutorCount ) );
          }
View Full Code Here
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.