datanucleus-rdbms provides persistence of Java objects to RDBMS datastores. It builds on top of the basic persistence provided by datanucleus-core
trunk can be checked out as follows
svn co https://svn.code.sf.net/p/datanucleus/code/platform/store.rdbms/trunk store.rdbms
datanucleus-rdbms is downloadable as following
datanucleus-rdbms is dependent on the following packages of software. Click on the name to go to the home page for that software to download it.
|datanucleus-core||3.2.0.m2+||Provides logging, localisation, and other framework facilities for DataNucleus.||Yes|
All SQL generated in DataNucleus AccessPlatform from version 2.0 onwards use an SQL API. This is stored in the store.rdbms plugin under the package(s) org.datanucleus.store.rdbms.sql.
A table group is a group of tables in the SQL statement. The SQL statement will be composed of 1 or more table groups. A table group equates to an object in an object-based query language. For example the candidate object will be in the first table group. When a relation is navigated the related object will be in its table group. And so on. All of the way down an inheritance tree will use the same table group; by that we mean that if you have a class Person and class Employee which extends Person and they have their own tables in the datastore, then when referring to the candidate object of type Employee, the tables PERSON and EMPLOYEE will be in the same table group.
With the SQLStatement API a developer can select the aliases of tables in the SQL statement. If they don't select an alias then the aliases will be generated for them using a DataNucleus plugin.
The plugin-point org.datanucleus.store.rdbms.sql_tablenamer defines an interface to be implemented by plugins for naming of tables. The default option is alpha-scheme.
alpha-scheme will name tables based on the table group they are in and the number of the table within that group. So you will get table aliases like A0, A1, A2, B0, B1, C0, D0. In this case we have a candidate object in the query with 3 tables (A0, A1, A2) and relations to an object with 2 tables (B0, B1) and these have relations to other objects with a single table (C0), (D0).
t-scheme will name tables based on the table number in the statement as a whole and doesn't use the table group for anything. So you get table aliases like T0, T1, T2, T3, T4, T5, etc.
To define which namer plugin you want to use, set the extension datanucleus.sqlTableNamingStrategy on the SQLStatement and by the persistence property datanucleus.rdbms.sqlTableNamingStrategy at construction of the PMF/EMF.