[
https://issues.apache.org/jira/browse/OPENJPA-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758373#action_12758373
]
Milosz Tylenda commented on OPENJPA-1304:
-----------------------------------------
I expect many users would like quite a lot the possibility to provide their own
naming policies. The JPA defaults probably look awkward to many DBAs.
At a first glance I find the issue quite risky. How about targetting this to
the 2.1 release?
I find DBDictionary overfatted and it's getting fatter every month. Maybe it
could be desirable and possible to move as much code as we can to that new
DatabaseElementNamingPolicy. Probably a uni/bi-directional link would need to
exist between DBDictionary and DatabaseElementNamingPolicy. Another idea would
be to make DatabaseElementNamingPolicy database-aware (possibly supplying it
with a live connection). That would further lessen the burden from DBDicitonary
but I am not sure it justifies combining policy with database specifics.
Would using the policy need a live connection?
If user specifies a table or column name in anno/xml that is incorrect for the
database, do we modify the name or complain?
The change could also address OPENJPA-84 - use quoting instead of appending
digits.
As for identifier lengths we could try getting them from drivers by default and
keep the possibility of configuring them thru properties as a hack for crazy
drivers. But that won't work if identifier lengths need to be known without a
connection (offline).
> Refactor naming policy of database schema elements
> --------------------------------------------------
>
> Key: OPENJPA-1304
> URL: https://issues.apache.org/jira/browse/OPENJPA-1304
> Project: OpenJPA
> Issue Type: Improvement
> Components: jdbc, jpa, kernel, query, sql
> Affects Versions: 2.0.0-M3, 2.0.0-M4, 2.0.0
> Reporter: Pinaki Poddar
> Assignee: Pinaki Poddar
> Fix For: 2.0.0
>
>
> The issue of naming database elements
> (Table/Column/Schema/Sequence/Constraints) is getting trickier with several
> aspects
> a) The logic/protocol of naming of database elements is somewhat
> well-spread at different parts
> b) few assumptions are implicit (like full name of a table is a
> concatenation of schema.table -- but MySQL, for example, will not like that)
> c) other 'container' things often cache these elements by their names but
> these names may get shortened/modified because of database length
> restrictions/keyword clash
> d) database variations impose few other twists (such as case-sensitivity)
> -- all these make naming a complex issue. One can see when methods like
> MappingDefaults.correctName() appear -- as if we know we have done mistakes
> elsewhere :)
> e) the proverbial straw on the camel's back is the new JPA 2.0 requirement
> of these names be optionally quoted/delimited with default/platform specific
> quote characters.
>
> The question is should we attempt refactoring name-related operations into a
> DatabaseElementNamingPolicy?
> Is it too risky?
> If we do how the policy works with DBDictionary?
> How can we ensure backward compatibility?
> How can we leverage it by adding new features that follow some rules to map
> name persistent Java element names to database element names saving the user
> to specify column names everywhere?
> Comments/Thoughts?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.