I posed the following questions to the hibernate-dev mailing list – figured I'd try here as well:
I've been working a bit on HHH-1904[1] – truncating identifiers based on a maximum length provided by the Dialect. As an example, a quick test that has a variety of uniques produced the constraint names in [2].
My initial strategy took metamodel's ObjectName and modified it to automatically handle name segments and quoting. For example, `UK_FooClass_1` would be broken down into "UK", "FooClass", and "1" segments, "_" would be the delimiter, and quoting would be added back in whenever necessary.
I'm trying to find a decent strategy for truncating the name, either as a whole or with each segment. The problem that I keep running into is that it's going to be difficult to dynamically ensure that naming collisions are avoided. For example, if embedded classes are used as entities, you could have 2 constraint names like "UK_OuterClass$InnerClassA_1" and "UK_OuterClass$InnerClassB_1". If the middle segment is truncated at or before the "$", it won't work.
Should we try to enforce a rule that the "unique bits" be in a specific segment or position? Alternatively, "truncate" by hashing the name (as we do with FK names now – of course, no human readability)? Any other ideas?
Admittedly, I may be overthinking it. It's primarily the Hibernate-generated constraint names that we need to worry about...
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
I posed the following questions to the hibernate-dev mailing list – figured I'd try here as well: