package bamboo.crawl;

import bamboo.pandas.PandasAgency;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.SqlBatch;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.helpers.MapResultAsBean;

import java.util.List;

public interface AgencyDAO {
    @SqlQuery("SELECT * FROM agency WHERE id = :id")
    @MapResultAsBean
    Agency findAgencyById(@Bind("id") int id);

    @SqlBatch("REPLACE INTO agency (id, name, abbreviation, url, logo) VALUES (:id, :name, :abbreviation, :url, :logo)")
    void replaceAll(@BindBean List<PandasAgency> listAgencies);
}

@@ -482,15 +482,14 @@
 ch(%22
-REPLACE
+INSERT
  INT
@@ -533,16 +533,33 @@
 , logo) 
+%22 +%0A            %22
 VALUES (
@@ -597,16 +597,126 @@
 , :logo)
+ %22 +%0A            %22ON DUPLICATE KEY UPDATE name = :name, abbreviation = :abbreviation, url = :url, logo = :logo
 %22)%0A    v

Use 'on duplicate key update' rather than 'replace into'