Use delete() instead of truncate() to avoid errors. 

Truncating a table with foreign keys will throw a QueryException. Using the delete method empties the table just as well yet won't throw an exception.