Skip to content

Commit

Permalink
Merge pull request playframework#238 from lights51/bug1
Browse files Browse the repository at this point in the history
[playframework#721] Fixtures.deleteAllModels() tried to delete classes that are not an Entity
  • Loading branch information
erwan committed Jun 1, 2011
2 parents f856ac0 + 46b9520 commit 5276122
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions framework/src/play/test/Fixtures.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ public static void delete(Class<? extends Model>... types) {
}

for (Class<? extends Model> type : types) {
try {
Model.Manager.factoryFor(type).deleteAll();
} catch(Exception e) {
Logger.error(e, "While deleting " + type + " instances");
// A Model might not be an Entity if it is a sub-class.
if (type.isAnnotationPresent(javax.persistence.Entity.class)) {
try {
Model.Manager.factoryFor(type).deleteAll();
} catch(Exception e) {
Logger.error(e, "While deleting " + type + " instances");
}
}

}

for (DBConfig dbConfig : DB.getDBConfigs()) {
Expand Down

0 comments on commit 5276122

Please sign in to comment.