From: <leg...@at...> - 2003-08-04 11:45:14
|
The following comment has been added to this issue: Author: Timo Verhoeven Created: Mon, 4 Aug 2003 6:44 AM Body: Proposal: (*) add a package net.sf.hibernate.namingstrategy for the following classes (*) create an abstract root class NamingStrategy String getPrefixedColumnName(String columnName, Type columnType) String getPrefixedTableName(String tableName) String getPrefixedSequenceName(String sequenceName) String getPrefixedXXXName(...) // What am I missing here? Comments? (*) create a DefaultNamingStrategy class, which returns parameters unchanged (*) create a SimpleNamingStrategy prefixing tables with "tbl", columns with "fld", and sequences with "gen" (*) create a TypeNameStrategy prefixing tables with "tbl", sequences with "gen", and columns with a type based prefix ("int" for Integers, ...) (*) introduce a mappingStrategy attribute to the <hibernate-mapping> tag, respectively add a property to the Configuration; both of which may be omitted/unset - the DefaultNamingStrategy is used then (*) modify existing Hibernate classes in packages .mapping and .cfg to make them use NamingStrategies I'm currently biased towards prefixing "default names" (i.e. column attribute not given and the property name is used) AND names provided by the user. Otherwise it would not be possible to switch the naming strategy on the fly, because user provided names would have to be manually prefixed to a SINGLE naming strategy to "fit in". Opinions, comments? --------------------------------------------------------------------- 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 |