[hibernate-dev] Naming and "naming strategies"
Steve Ebersole
steve at hibernate.org
Fri Jan 16 09:15:13 EST 2015
On Fri, Jan 16, 2015 at 8:10 AM, Steve Ebersole <steve at hibernate.org> wrote:
>
> Also, I’ve been toying with the idea of naming strategy AOP:
>> - ability to lowercase all columns
>> - ability to replace . with _
>> - ability to replace $ with something else
>> - etc
>>
>> but I don’t see a good way to do this that would remain properly
>> understandable by everyone (incl. the same person 3 months later).
>>
>
> I can see this working by allowing naming strategy to accept "rules"
> (insert better name here) that define componentized aspects of the naming
> rule. For example, consider:
>
> new AggregatedNamingStrategy(
> AllLowerNamingRule.INSTANCE,
> DotToUnderscoreRule.INSTANCE,
> DollarSignToUnderscoreRule.INSTANCE
> );
>
> Though, I think some of these fit better in implicit naming and others in
> physical naming.
>
Also, we want to be very careful with stuff like "all lower naming rule".
For example, think of JPA's "quote all identifiers" setting. In fact, to
circle back to a question Gunnar asked, this is one of the reasons I want
to have PhysicalNamingStrategy accept Identifier (with quoted/unquoted
flag) and return Identifier.
More information about the hibernate-dev
mailing list