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 |
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 |
From: <leg...@at...> - 2003-08-04 14:01:14
|
The following comment has been added to this issue: Author: Gavin King Created: Mon, 4 Aug 2003 9:00 AM Body: I think you're being too specific here! Don't think only about prefixes - that is just one application! For example, I might want to change the class name com.package.FooBar to the table name PACKAGE_FOO_BAR. And also consider whether you _really_ want to pass column names to the same method as property names, and table names to the same method as class names. I think a NamingStrategy might need to handle properties w/o column mappings differently to mapped column names. --------------------------------------------------------------------- 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 |
From: <leg...@at...> - 2003-08-06 18:19:13
|
The following comment has been added to this issue: Author: Timo Verhoeven Created: Wed, 6 Aug 2003 1:18 PM Body: Ok, I think I got your point: you'd prefer an implementation providing customizable default names for tables/columns/sequences in addition to customizable prefixes. New proposal for methods: String getColumnName(...) String getTableName(...) String getSequenceName(...) String overrideColumName(...) String overrideTableName(...) String overrideSequenceName(...) Opinions? --------------------------------------------------------------------- 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 |
From: <leg...@at...> - 2003-08-10 00:15:14
|
The following comment has been added to this issue: Author: Gavin King Created: Sat, 9 Aug 2003 7:14 PM Body: Looks good to me. :) --------------------------------------------------------------------- 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 |
From: <leg...@at...> - 2004-01-31 03:36:15
|
The following comment has been added to this issue: Author: Bertrand Renuart Created: Thu, 29 Jan 2004 5:25 PM Body: Isn't this feature included in 2.1.1 through the pluggable NamingStratgey ? --------------------------------------------------------------------- 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 Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Versions: 2.0.2 Assignee: Reporter: Timo Verhoeven Created: Mon, 4 Aug 2003 6:29 AM Updated: Thu, 29 Jan 2004 5:25 PM 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 |