com.company.sakila.db0.sakila.rental.generated.GeneratedRentalSqlAdapter Maven / Gradle / Ivy
package com.company.sakila.db0.sakila.rental.generated;
import com.company.sakila.db0.sakila.rental.Rental;
import com.company.sakila.db0.sakila.rental.RentalImpl;
import com.speedment.common.annotation.GeneratedCode;
import com.speedment.runtime.config.identifier.TableIdentifier;
import com.speedment.runtime.core.component.SqlAdapter;
import com.speedment.runtime.core.db.SqlFunction;
import java.sql.ResultSet;
import java.sql.SQLException;
import static com.speedment.common.injector.State.RESOLVED;
/**
* The generated Sql Adapter for a {@link
* com.company.sakila.db0.sakila.rental.Rental} entity.
*
* This file has been automatically generated by Speedment. Any changes made to
* it will be overwritten.
*
* @author Speedment
*/
@GeneratedCode("Speedment")
public abstract class GeneratedRentalSqlAdapter implements SqlAdapter {
private final TableIdentifier tableIdentifier;
protected GeneratedRentalSqlAdapter() {
this.tableIdentifier = TableIdentifier.of("db0", "sakila", "rental");
}
protected Rental apply(ResultSet resultSet, int offset) throws SQLException {
return createEntity()
.setRentalId( resultSet.getInt(1 + offset))
.setRentalDate( resultSet.getTimestamp(2 + offset))
.setInventoryId( resultSet.getInt(3 + offset))
.setCustomerId( resultSet.getInt(4 + offset))
.setReturnDate( resultSet.getTimestamp(5 + offset))
.setStaffId( resultSet.getShort(6 + offset))
.setLastUpdate( resultSet.getTimestamp(7 + offset))
;
}
protected RentalImpl createEntity() {
return new RentalImpl();
}
@Override
public TableIdentifier identifier() {
return tableIdentifier;
}
@Override
public SqlFunction entityMapper() {
return entityMapper(0);
}
@Override
public SqlFunction entityMapper(int offset) {
return rs -> apply(rs, offset);
}
}