You need a configured dictionnary otherwise the namingutil is null

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le mer. 13 juin 2018 à 14:41, Yves PIEL <ypiel.talend....@gmail.com> a
écrit :

> Moreover, when I try to remplace DefaultIdentifierConfiguration by
> MySQLDictionary, just to test, NPE is raised since default identifier rule
> is not set and getDefaultIdentifierRule() return null.
>
> Yves
>
> On 13 June 2018 at 14:31, ypiel <ypiel.talend....@gmail.com> wrote:
>
> > Hi,
> >
> > To be more precise, it is not DBIdentifier#setName but the
> > Normalizer#normalizer that is static:
> >
> > https://github.com/apache/openjpa/blob/ffe3fe4a5051632d15973a00847676
> > 12ab22ad17/openjpa-jdbc/src/main/java/org/apache/openjpa/
> > jdbc/identifier/Normalizer.java#L33
> > ------------------------------------
> > public class Normalizer {
> >
> >     private static IdentifierUtil normalizer =
> >             new DBIdentifierUtilImpl(new DefaultIdentifierConfiguration
> > ());
> >
> >     private static IdentifierRule defaultRule;
> >
> >     static {
> >         defaultRule =
> > normalizer.getIdentifierConfiguration().getDefaultIdentifierRule();
> >     }
> >
> >     ....
> >
> >     public static String delimit(String name, boolean force) {
> >         return normalizer.delimit(defaultRule, name, force);
> >     }
> > ------------------------------------
> >
> > And as you can see the Normalizer#delimit method use the static
> > IdentifierUtil which is configured with the
> DefaultIdentifierConfiguration
> > .
> > It does not take into account the dictionary.
> >
> > So when you call something like DBIdentifier.newSchema("My-schema"), it
> > always use DefaultIdentifierConfiguration to delimit identifier.
> >
> > Regards,
> > Yves
> >
> >
> >
> > --
> > Sent from: http://openjpa.208410.n2.nabble.com/OpenJPA-Developers-
> > f210739.html
> >
>

Reply via email to