I searched through the forum and found a few other users tried to do a similiar thing, but couldn't find a definite answer or sample code. Here's what I came up after the research,
Code:
PersistentClass pClass = config.getClassMapping(clazz);
Table table = pClass.getTable();
table.setName(newTableName);
pClass.setTable(table);
It is not working unfortunately. The table name was changed successfully, but the generated SQL still points to the old table name. It there cache somewhere that I need to invlidate/refresh?
Someone in the forum mentioned using custom persister for this requirement. Are there any examples that I can look into?
Thanks.