This content has been marked as final.
Show 1 reply
-
1. Re: table prefixes
ret Aug 4, 2010 6:57 AM (in response to ret)i think i found some solution, but im not that satisfied with it
you can extend the persistence.xml with the following:
<property name="hibernate.ejb.naming_strategy" value="com.mycompany.persistence.NamingStrategy"/>
and create a Class NamingStrategy that extends org.hibernate.cfg.ImprovedNamingStrategy:
import org.hibernate.cfg.ImprovedNamingStrategy; import org.hibernate.util.StringHelper; public class NamingStrategy extends ImprovedNamingStrategy { private static final long serialVersionUID = -734450386268904960L; public String classToTableName(String className) { return StringHelper.unqualify(className); } public String tableName(String tableName) { return "%company%" + tableName; } public String propertyToTableName(String className, String propertyName) { return "%company%$" + classToTableName(className) + '_' + propertyToColumnName(propertyName); } }
On deploy at customer you can compile this class and substititute %company% before.
any other ideas?