stmt.execute(sql); for (Iterator iter = table.getConstraints().iterator(); iter.hasNext(); ) { Constraint con = (Constraint) iter.next(); if (con.isDeferred()) { m_constraints.add(con); }
try { stmt.execute(sql); } catch (SQLException e) { throw new IllegalStateException(e.getMessage() + "\n\n" + sql);
    private void setup() throws SQLException {        m_root = new Root();        m_conn = Connections.acquire(RuntimeConfig.getConfig().getJDBCURL());        PDL pdl = new PDL();        pdl.loadResource("com/redhat/persistence/oql/test.pdl");        pdl.emit(m_root);        Collection tables = m_root.getTables();        m_constraints = new ArrayList();        Statement stmt = m_conn.createStatement();        for (Iterator it = tables.iterator(); it.hasNext(); ) {            Table table = (Table) it.next();            String sql = table.getSQL();            stmt.execute(sql);            for (Iterator iter = table.getConstraints().iterator();                 iter.hasNext(); ) {                Constraint con = (Constraint) iter.next();                if (con.isDeferred()) { m_constraints.add(con); }            }        }        for (Iterator it = m_constraints.iterator(); it.hasNext(); ) {            Constraint con = (Constraint) it.next();            stmt.execute("alter table " + con.getTable().getName() +                         " add " + con.getSQL());        }        stmt.close();        ConnectionSource src = new ConnectionSource() {            public Connection acquire() { return m_conn; }            public void release(Connection conn) {}        };        Engine engine = new RDBMSEngine(src, new PostgresWriter());        Session ssn = new Session(m_root, engine,new DynamicQuerySource());        DataLoader loader = new DataLoader(ssn);        XML.parseResource("com/redhat/persistence/oql/data.xml", loader);        ssn.flush();    }