prevent Ebean from issuing duplicate SQL when generating the database so it doesnt fail. A problem for classes with the same generator

This commit is contained in:
Richard Vowles
2013-05-03 20:06:18 +12:00
parent 26a8af8c5b
commit d2f532ad3c
@@ -234,10 +234,17 @@ public class DdlGenerator implements SpiEbeanPlugin {
* Execute the list of statements.
*/
private void runStatements(boolean expectErrors, List<String> statements, Connection c) {
List<String> noDuplicates = new ArrayList<String>();
for (int i = 0; i < statements.size(); i++) {
String xOfy = (i + 1) + " of " + statements.size();
runStatement(expectErrors, xOfy, statements.get(i), c);
for (String statement : statements) {
if (!noDuplicates.contains(statement)) {
noDuplicates.add(statement);
}
}
for (int i = 0; i < noDuplicates.size(); i++) {
String xOfy = (i + 1) + " of " + noDuplicates.size();
runStatement(expectErrors, xOfy, noDuplicates.get(i), c);
}
}