package corporate.hoteisadmin6;
import java.sql.Connection;
import java.sql.PreparedStatement;
import lumis.portal.PortalException;
import lumis.portal.UnexpectedException;
import lumis.portal.dao.DaoException;
import lumis.portal.dao.jdbc.ITransactionJdbc;
import lumis.util.ITransaction;
public class HotelDaoJdbc
{
public void definirLotados(String[] hotelIds, ITransaction transaction) throws DaoException, PortalException
{
try
{
ITransactionJdbc daoTransactionJdbc = (ITransactionJdbc) transaction;
Connection connection = daoTransactionJdbc.getConnection();
String hotelIdsList = "";
for(String hotelId : hotelIds)
hotelIdsList += "'"+hotelId+"',";
if(hotelIdsList.length() > 0)
hotelIdsList = hotelIdsList.substring(0, hotelIdsList.length()-1);
else
return;
PreparedStatement statement = connection.prepareStatement("update tr3_hotel set lotado = 1 where hotelId in ("+hotelIdsList+")");
try
{
statement.executeUpdate();
}
finally
{
statement.close();
}
}
catch (PortalException e)
{
throw e;
}
catch (Exception e)
{
throw new UnexpectedException(e);
}
}
}
|