[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2197) make more information about the persistent class available to NamingStrategy methods

Julien HENRY (JIRA) noreply at atlassian.com
Mon Oct 15 05:37:41 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28428 ] 

Julien HENRY commented on HHH-2197:
-----------------------------------

Another wish: could you please provide schema name to 

public String tableName(String tableName)

Because I want to prefix table name only for table in a specific schema. Existing tables in other schema should keep their existing name.

I would like to write something like:

public String tableName(String tableName, String schema) {
    if (myAppSchema.equals(schema)) {
        tableName = "MYAPP_" + tableName;
    }
    return tableName;
}

Thanks

> make more information about the persistent class available to NamingStrategy methods
> ------------------------------------------------------------------------------------
>
>                 Key: HHH-2197
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2197
>             Project: Hibernate3
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.2.0.ga
>         Environment: all environments
>            Reporter: Jason Trump
>            Priority: Minor
>
> Currently NamingStrategy.propertyToColumnName() implementations are only passed the bare property name for persistent entities, without any information about which class is being persisted.  It would be nice if the persistent classname was also provided, so that information about the class could be used in deciding how to generate the column name.
> To give an example, in a client's database, all of the column names begin with an abbreviation of the table name itself:
> create table TBL_Foo ( 
>      FooUuid           tinyint primary key,
>      FooProperty     varchar(32)
> )
> maps to class:
> public class Foo {
>    private Integer uuid;
>    private String property;
>    ....
> }
> Right now propertyToColumnName(String) is only called with the arguments "uuid" or "property", making it impossible to automatically prefix "Foo" with a NamingStrategy.  To preserve backwards-compatibility, maybe we could get another version of propertyToColumnName, like
> /**
>  * @param className fully-qualified className of the persistent class, or entity-name for non-pojo persistence
>  * @param propertyPath property name relative to <code>className</code>
>  */
> public String propertyToColumnName(String className, String propertyPath);
> with similar overloaded versions on other methods in the interface, with the same idea.  apologies if this type of thing is already available in the current release, but I didn't find evidence of this either in the forums or by inspecting the code.
> thanks for hibernate and Hibernate entitymanager!  i've been a fan for several years now.

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list