try{
try {
local = HibernateUtil.startLocalTransactionIfNeeded();
} catch (DotDataException e1) {
Logger.error(TemplateFactoryImpl.class,e1.getMessage(),e1);
throw new DotHibernateException("Unable to start a local transaction " + e1.getMessage(), e1);
}
HibernateUtil.delete("from template_containers in class com.dotmarketing.beans.TemplateContainers where template_id = '" + template.getIdentifier() + "'");
for(Container container:containerIdentifiers){
TemplateContainers templateContainer = new TemplateContainers();
templateContainer.setTemplateId(template.getIdentifier());