From: <leg...@at...> - 2003-08-04 11:32:14
|
The following comment has been added to this issue: Author: Timo Verhoeven Created: Mon, 4 Aug 2003 6:30 AM Body: Gavin's comment from the mailing list: Yes, I can certainly see the attraction - and it *has* been requested before. It would be nice to be able to plug in a something like: NamingStrategy strategy = new MyCustomNamingStrategy(); Configuration cfg = new Configuration(); cfg.setNamingStrategy(strategy); perhaps we could even allow this as: <hibernate-mapping naming="pkg.MyCustomNamingStrategy"> The naming strategy itself would have methods like: String getColumnName(String propertyName) String getTableName(String className) String overrideColumName(String columnName) String overrideTableName(String tableName) Add a feature request to JIRA! Note that this is *really* easy to do, with just a little bit of playing with the .cfg package. Why not implement it yourself, and send a patch? --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-227 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-227 Summary: NamingStrategy / prefix support for database objects Type: New Feature Status: Unassigned Priority: Minor Project: Hibernate2 Components: core Versions: 2.0.2 Assignee: Reporter: Timo Verhoeven Created: Mon, 4 Aug 2003 6:29 AM Updated: Mon, 4 Aug 2003 6:29 AM Description: Initial feature idea from mailing list: Hi all! When I design database datamodels I usually encounter clashes between reserved names and names I'd like to use for my tables/columns, e.g. "user", "role", etc.. So I ended up prefixing all tables/views/columns: Tables have a "tbl" prefix, views a "qry" prefix and columns either have a "fld" or a prefix based on the datatype ("txt"/"str" for varchars, etc.). I like to keep my mapping files small (/ to have few xdoclet tags) and like the fact that hibernate has smart default for column names: it uses the property's name. Would it be possible/would you consider it useful to be able to specify "default prefixes" for tables/columns so that I don't have to name my columns manually in my mappings when I have to use prefixes? Such settings could go into the SessionFactory configuration. Opinions? Timo --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |