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

Jason Trump (JIRA) noreply at atlassian.com
Mon Oct 30 17:53:04 EST 2006


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
        Type: Improvement

  Components: core  
    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