[hibernate-dev] Naming and "naming strategies"
steve at hibernate.org
Mon Feb 2 11:51:41 EST 2015
On Mon, Feb 2, 2015 at 8:34 AM, Emmanuel Bernard <emmanuel at hibernate.org>
I think you’re missing things like @MapKeyColumn, @OrderColumn
So that's a good discussion. These are things that have previously been
hard-coded defaults (at least on hbm side) and therefore had no specific
naming strategy hooks. I'm all for being specific, so if everyone agrees
it is a good idea to add methods for stuff like this, I am fine with that.
> Also, you might think about embedded objects. I think today the implicit
> contract received the qualified property names separated by dots
> e.g. “homeAddress.street”. should that continue as it is or is there a need
> for abstraction?
This is already handled well IMO. The naming strategy is handed an
AttributePath, which is a "composite name" object. E.g.
"homeAddress.street" is defined as:
new AttriubutePath().append( "homeAddress" ).append( "street" );
For completeness, there is also a paired AttributeRole for each
AttributePath which has the same "path", but which includes the base:
new AttributeRole( "com.acme."Company" ).append( "homeAddress" ).append(
The naming strategy is only passed the AttributePath form. They both give
access to each individual part of the path, as well as access to the "full
path" (e.g., “homeAddress.street”). So I think this is pretty well covered.
> On 31 Jan 2015, at 03:33, Steve Ebersole <steve at hibernate.org> wrote:
> So here is what I have for implicit naming strategy, in simplified form:
> 1. Table naming
> 1. Entity primary table - @Table
> 2. Join table - @JoinTable
> 3. Collection table - @CollectionTable
> 4. <secondary table are required to be explicitly named>
> 2. Column naming
> 1. basic attribute column
> 2. entity discriminator column
> 3. tenant id column
> 4. @Any discriminator column
> 5. @Any key column
> 6. @JoinColumn
> 7. @PrimaryKeyJoinColumn
> Especially as far as column naming goes, can anyone see any I am missing?
> On Fri, Jan 23, 2015 at 10:43 AM, Steve Ebersole <steve at hibernate.org>
>> Thanks Max for validating I am not going insane... at least in regards to
>> this :)
>> On Fri, Jan 23, 2015 at 10:19 AM, Max Rydahl Andersen <
>> manderse at redhat.com> wrote:
>>> On 23 Jan 2015, at 14:18, Steve Ebersole wrote:
>>>  - I vaguely recall seeing that certain databases allow different
>>>> constraints for different types of identifiers (table name, versus
>>>> name, versus constrain name, ...). Can anyone confirm that?
>>> I remember db2 have this fun.
>>> I believe Oracle has too but couldn't find evidence for it.
More information about the hibernate-dev