[hibernate-dev] New metamodel and NamingStrategy

Steve Ebersole steve at hibernate.org
Tue Feb 21 11:12:53 EST 2012

We discussed this a little in the meeting.  

There is another, contradictory "requirement" that the sources 
(org.hibernate.metamodel.spi.sources) be able to report back all 
logical names.  Initially we had decided to try and have sources return 
null to indicate that the naming strategy should be applied to infer 
the table name.  Thus column sources would need to return null as well 
in response to RelationalValueSource#getContainingTableName to indicate 
they come from the "primary" table (since sources don't know that 
NamingStrategy inferred name).  There is a particular case that I am 
not sure this "return null" approach will work, namely the various 
relational parts of a collection.  If we end up needing to push the 
calls to NamingStrategy down into the sources, the calls will still 
need to be the same old string-based ones.

On Mon 20 Feb 2012 01:15:56 PM CST, Steve Ebersole wrote:
> Grrr, of course that last line should have read:
> Essentially replaces NamingStrategy#classToTableName
> On Fri 17 Feb 2012 01:01:09 PM CST, Steve Ebersole wrote:
>> As an example to start discussions, here is my first method proposal:
>> public interface LogicalNamingStrategy {
>> /**
>> * Determine the logical table name to use for the specified entity in 
>> cases where the mapping did
>> * not specify one explicitly.
>> *
>> * @param entity The entity for which to determine the table name.
>> *
>> * @return The table name identifier to use
>> */
>> public Identifier logicalTableName(Entity entity);
>> }
>> Essentially replaces NamingHelper#classToTableName
>> On Fri 17 Feb 2012 12:25:37 PM CST, Steve Ebersole wrote:
>>> In Austin we had discussed splitting up NamingStrategy into 
>>> LogicalNamingStrategy and PhysicalNamingStrategy. I am starting to 
>>> think though and work on that task.
>>> We said that the "sources" (the collective term for annotations and 
>>> hbm.xml) would return null to indicate that the logical naming 
>>> should kick in. The idea being to allow the sources to remain as 
>>> true as possible to the actual user supplied values.
>>> Anyway, just wanted to open this up to wider discussion.
>>> Btw the related issues are:
>>> https://hibernate.onjira.com/browse/HHH-7077
>>> https://hibernate.onjira.com/browse/HHH-7078
>>> https://hibernate.onjira.com/browse/HHH-7079

steve at hibernate.org

More information about the hibernate-dev mailing list