Been thinking how reign in our mapping layer in Cayenne 6.0 to simplify both 
mapping and runtime inference. Here are some ideas:

1. Simpler XML: Single XML file for a project. No more separation into project 
and DataMap. All the external schema includes (cgen, dbImport, comment) are 
made a converted into regular tags (but still optional to load). Multiple 
projects can of course be merged together in runtime they way they are now.

2. "Package" as a the main mapping namespace unit. This replaces DataMap. The 
name is a Java package name (that is currently buried in DataMap config).

3. Package defaults to simplify mapping and steer towards alignment of DB and 
Java namespaces:
   
   class name = parent package + entity name
   table FQN = parent catalog + parent schema + table name // allow to override 
per table

4. Single mapping layer. No more Db vs Obj. Just Entity, Attribute, 
Relationship, that bring together both sides. We cut the mapping by 50%. EOF 
got it right, we didn't!

5. Runtime mapping layer separate from modeling layer. Runtime Entity, 
Attribute, Relationship are immutable, still split into Obj vs Db. Objects 
cross-references are direct, not by name. So it is more efficient and easier to 
navigate (invalid states are handled during compilation).

6. OR Model changes/additions for cleaner, more efficient representation:

   Allow to model sets of non-PK unique columns. This will give us to-one's to 
non-PK (a big gap we currently have)
   Model FKs as they are modeled in DB: "one-way FK constraint to a set of 
target columns"
   To-one / to-many will no longer need to be modeled explicitly. It will be 
calculated from FK and target uniqueness. 

7. Rethink inheritance. Support horizontal; change vertical root to its own 
table (instead of mapping paths from the super root table).


Of course, all I really wanted was to implement #6, but got into a deep rabbit 
hole trying to properly arrange the legos :)

Comments? 

Andrus

   


Reply via email to