A datastore identifier is a simple name of a database object, such as a column, table, index, or view, and is composed of a sequence of letters, digits, and underscores ( _ ) that represents it's name. DataNucleus allows users to specify the names of tables, columns, indexes etc but if the user doesn't specify these DataNucleus will generate names.
With RDBMS the generation of identifier names is controlled by an IdentifierFactory, and DataNucleus provides a default implementation for JPA. You can provide your own RDBMS IdentifierFactory plugin to give your own preferred naming if so desired. For RDBMS you set the RDBMS IdentifierFactory by setting the persistence property datanucleus.identifierFactory. Set it to the symbolic name of the factory you want to use.
With non-RDBMS the generation of identifier names is controlled by a NamingFactory and again a default implementation for JPA. You can provide your own NamingFactory plugin to give your own preferred naming if so desired. You set the NamingFactory by setting the persistence property datanucleus.identifier.namingFactory. to give your own preferred naming if so desired. Set it to the symbolic name of the factory you want to use.
In describing the different possible naming conventions available out of the box with DataNucleus we'll use the following example
class MyClass { String myField1; Collection<MyElement> elements1; // Using join table Collection<MyElement> elements2; // Using foreign-key } class MyElement { String myElementField; MyClass myClass2; }
The NamingFactory "jpa" aims at providing a naming policy consistent with the "JPA" specification.
Using the same example above, the rules in this NamingFactory mean that, assuming that the user doesn't specify any <column> elements :-
The RDBMS IdentifierFactory "jpa" aims at providing a naming policy consistent with the JPA specification.
Using the same example above, the rules in this IdentifierFactory mean that, assuming that the user doesnt specify any <column> elements :-
The underlying datastore will define what case of identifiers are accepted. By default, DataNucleus will capitalise names (assuming that the datastore supports it). You can however influence the case used for identifiers. This is specifiable with the persistence property datanucleus.identifier.case, having the following values
Please be aware that some datastores only support UPPERCASE or lowercase identifiers and so setting this parameter may have no effect if your database doesn't support that option. Please note also that this case control only applies to DataNucleus-generated identifiers. If you provide your own identifiers for things like schema/catalog etc then you need to specify those using the case you wish to use in the datastore (including quoting as necessary)