datanucleus-core icon indicating copy to clipboard operation
datanucleus-core copied to clipboard

CompleteClassTable : support column names for embedded collection element (map key/value, array element)

Open andyjefferson opened this issue 8 years ago • 0 comments

CompleteClassTable should potentially be able to provide naming for embedded collection elements (where the element is stored nested in something like a JSON/XML object), or embedded map keys/values, etc.

Currently this is not handled completely. We support nested embedded PC fields, and simply store the ColumnImpl into columns/columnByName (keyed by its column name), and its MemberColumnMappingImpl into mappingByEmbeddedMember (keyed by its embedded member name PATH). The problems with this are that

  1. We cannot cope with storing embedded keys AND values this way, since if we have a field map then we would just get the mappingByEmbeddedMember path for a field field1 of key as map.field1, and if the value had a field of the same name (hence map.field1) then how would we know it was for the value?
  2. There is no concept of hierarchy to represent where we are storing the members as "nested", we just have their embedded member path and have to extract it
  3. We currently have a check whether a column is already used for a "table", and if a nested column name clashes with a column name for a primary field of the main class then we get an exception!

The problem with changing the way these MemberColumnMapping and Column objects are stored is that they are accessed from the store plugins for Cassandra, Excel, HBase, JSON, MongoDB, Neo4j, and ODF. Consequently these plugins would need updating to use the "new" API

andyjefferson avatar Apr 11 '16 07:04 andyjefferson