com.company.sakila.db0.sakila.film.generated.GeneratedFilmSqlAdapter Maven / Gradle / Ivy
package com.company.sakila.db0.sakila.film.generated;
import com.company.sakila.db0.sakila.film.Film;
import com.company.sakila.db0.sakila.film.FilmImpl;
import com.speedment.common.annotation.GeneratedCode;
import com.speedment.common.injector.annotation.ExecuteBefore;
import com.speedment.common.injector.annotation.WithState;
import com.speedment.runtime.config.identifier.TableIdentifier;
import com.speedment.runtime.core.component.sql.SqlPersistenceComponent;
import com.speedment.runtime.core.component.sql.SqlStreamSupplierComponent;
import com.speedment.runtime.core.exception.SpeedmentException;
import java.sql.ResultSet;
import java.sql.SQLException;
import static com.speedment.common.injector.State.RESOLVED;
import static com.speedment.runtime.core.internal.util.sql.ResultSetUtil.*;
/**
* The generated Sql Adapter for a {@link
* com.company.sakila.db0.sakila.film.Film} entity.
*
* This file has been automatically generated by Speedment. Any changes made to
* it will be overwritten.
*
* @author Speedment
*/
@GeneratedCode("Speedment")
public abstract class GeneratedFilmSqlAdapter {
private final TableIdentifier tableIdentifier;
protected GeneratedFilmSqlAdapter() {
this.tableIdentifier = TableIdentifier.of("db0", "sakila", "film");
}
@ExecuteBefore(RESOLVED)
void installMethodName(@WithState(RESOLVED) SqlStreamSupplierComponent streamSupplierComponent,
@WithState(RESOLVED) SqlPersistenceComponent persistenceComponent) {
streamSupplierComponent.install(tableIdentifier, this::apply);
persistenceComponent.install(tableIdentifier);
}
protected Film apply(ResultSet resultSet) throws SpeedmentException {
final Film entity = createEntity();
try {
entity.setFilmId( resultSet.getInt(1) );
entity.setTitle( resultSet.getString(2) );
entity.setDescription( resultSet.getString(3) );
entity.setReleaseYear( resultSet.getDate(4) );
entity.setLanguageId( resultSet.getShort(5) );
entity.setOriginalLanguageId( getShort(resultSet, 6) );
entity.setRentalDuration( resultSet.getShort(7) );
entity.setRentalRate( resultSet.getBigDecimal(8) );
entity.setLength( getInt(resultSet, 9) );
entity.setReplacementCost( resultSet.getBigDecimal(10) );
entity.setRating( resultSet.getString(11) );
entity.setSpecialFeatures( resultSet.getString(12) );
entity.setLastUpdate( resultSet.getTimestamp(13) );
} catch (final SQLException sqle) {
throw new SpeedmentException(sqle);
}
return entity;
}
protected FilmImpl createEntity() {
return new FilmImpl();
}
}