package org.seamframework.sql;

import java.sql.SQLException;

public class ExecutableInsert extends ExecutableStatement {

	public ExecutableInsert(Insert<?> insert, Session session) {
		super(insert, session);
		
	}

	public ExecutableInsert(String insert, Session session) {
		super(insert, session);
	}
	
	@Override
	public void execute() {
		try {
			int rows = getPreparedStatement().executeUpdate();
			if (rows!=1) throw new RuntimeException(); 
		}
		catch (SQLException sqle) {
			throw new RuntimeException(sqle);
		}
	}
	
}
