I would like to modify the Hibernate Reverse Engineering templates to backtick all table and column references to fix compatibility issues between Hibernate and MySQL. I am using Hibernate 3.2 Annotations so I would like to change the Abstract data object POJO’s generation from:
@Column(name = "key", nullable = false, length = 2)
public String getKey() {
return this.key;
}
To:
// backticks around column name
@Column(name = "`key`", nullable = false, length = 2)
public String getKey() {
return this.key;
}
I have copied the velocity templates from com.genuitec.eclipse.hibernate_6.6.0.zmyeclipse660200810/templates into the project, but I can’t see where the annotation code is exposed in the templates.
Granted this should be handled by Hibernate like all of the MySQL utilities do, however, the Hibernate team keeps closing the issue whenever anyone brings this up saying ‘add the backticks to your mappings’. This would work, except in the case of reverse engineering where you are overwriting your mappings and you loose the backticks.
Is is possible to modify Hibernate Reverse Engineering to do this?