Hi.
I'm wondering, if there's an easy way to toggle whether hbmtemplate should overwrite existing files or not. I took a look at the POJO and Seam exporterclasses but I didn't find an option. Seems that the TemplateProducer always overwrites existing files. Is there something planned for the future?
After some digging I found something in the DAONewExporter:
Code:
/**
* Override to avoid overwriting the existing files
* In the final version this should be moved to GenericExporter
*/
protected void exportPOJO(Map additionalContext, POJOClass element)
{
String filename = resolveFilename(element);
File file = new File(getOutputDirectory(), filename);
if (file.exists() && !isOverwrite()) {
log.warn("Skipping the generation of file " + file + " because target already exists");
}
else {
super.exportPOJO(additionalContext, element);
}
}
Sounds that something is planned. For now I would have to implement my own GenericExporter which allows overwrite toggling.