Just took a pass at what it would take to implement the single-layer mapping 
design. Beyond the obvious "it is easier to work with", the main implication 
was something I haven't considered before: an introduction of consistent 
Java-like naming across all mapping artifacts (Entity, Attribute, 
Relationship), regardless of whether they are a part of object model or not. 
BTW, current DbRelationship names are a precursor of this, while feeling out of 
place in the current model. In any event, this is a new abstraction with 
arguably bigger consequences than everything else:

1. - Extra work: now a user will need to name all those join tables, FKs and 
PKs. I guess tooling helps to cover this gap.
2. + "db:" expressions become unneeded. A single Object-like expression syntax 
would cover the entire graph.
3. ! Should we change key names in ObjectId and DataRows? Seems like the 
logical thing to do, but is very invasive and will create a gap for raw SQL 
queries.

Also, the case that Jurgen brought up (multiple entities over the same table) 
proved to be a massive pain to handle. Doable, but takes back from the 
newly-gained simplicity.

So while still very tempting, now I am wondering whether this change is a 
bridge too far?

Andrus


> On Nov 17, 2026, at 11:28 AM, Andrus Adamchik <[email protected]> wrote:
> 
>> Something else to bear in mind is accommodating CreateIfNoSchemeStrategy 
>> when collapsing Db & Obj entities and then having multiple “views” over the 
>> same table.
> 
> SchemaUpdateStrategy works with the "compiled" representation of the model 
> where all these things are properly resolved. So don't see it being an issue.
> 
> 
>> Maybe there'll need to be a "DDL View" flag, or first group all entity 
>> attributes per table before generating ?
> 
> Modeler schema generation is separate from SchemaUpdateStrategy of course, 
> but I don't see why it would behave differently in this respect.
> 
> Andrus
> 
> 
> 
>> On Nov 16, 2026, at 6:42 AM, Jurgen Doll via dev <[email protected]> 
>> wrote:
>> 
>> Hi Andrus
>> 
>> Thanks for the reply.
>> Something else to bear in mind is accommodating CreateIfNoSchemeStrategy 
>> when collapsing Db & Obj entities and then having multiple “views” over the 
>> same table.
>> Maybe there'll need to be a "DDL View" flag, or first group all entity 
>> attributes per table before generating ?
>> 
>> Thanks regards
>> Jurgen
>> 
>> On Nov 14 2026, at 4:11 pm, Andrus Adamchik <[email protected]> wrote:
>>> Hi Jurgen,
>>> 
>>> Thanks for the feedback. We needed a sanity check on this. Note that we 
>>> already implemented #5 ("compiled" entities) on master: 
>>> https://github.com/apache/cayenne/tree/master/cayenne/src/main/java/org/apache/cayenne/map/compiled
>>>  which stays split. So the goal of #4 is to produce a mapping that can be 
>>> directly translated to a split runtime model.
>>>> Multiple “views” over the same table
>>> That would require multiple entities so there will be table / column 
>>> duplication. So you may argue this case will become harder. Though 
>>> copy/paste in the Modeler and DB import should help. Personally, I can't 
>>> imagine maintaining a model without DB import these days anyways.
>>>> Multi-table entities and flattened attributes/relationships
>>>> These are genuinely useful. I’m assuming the plan is to keep the 
>>>> capability (an Entity can still pull attributes across relationship 
>>>> paths), just without the separate DbRelationship bookkeeping. Is that the 
>>>> direction?
>>> 
>>> Correct. You'd map a flattened path over a chain of existing paths. And 
>>> then mark the underlying paths and intermediate entities as "not a class 
>>> property / not a class".
>>>> Seeing the full table structure
>>> It should be possible in the UI. Here is an idea: a "DDL View" showing the 
>>> corresponding "CREATE TABLE" statement. I am hoping the overall UX would 
>>> actually improve once the model becomes less fragile as a result of the #4 
>>> change.
>>> Thanks,
>>> Andrus
>>> 
>>> 
>>>> On Nov 12, 2026, at 11:50 AM, Jurgen Doll via dev <[email protected]> 
>>>> wrote:
>>>> 
>>>> Hi Andrus
>>>> 
>>>> I had to chew on item 4 a bit, i.e. the idea of collapsing Db vs Obj into 
>>>> a single Entity / Attribute / Relationship layer does make a lot of sense 
>>>> on paper and I can appreciate the appeal of cutting the mapping roughly in 
>>>> half.
>>>> That said, coming from years of working only with Cayenne’s current 
>>>> dual-layer approach, a few practical concerns keep coming up for me. I’d 
>>>> be interested in your thoughts on how these would be handled:
>>>> Multiple “views” over the same table
>>>> Today it’s straightforward to have several ObjEntities that map different 
>>>> subsets of the same DbEntity. In a single-layer world, would we still be 
>>>> able to have lightweight projections / secondary mappings without 
>>>> repeating the column definitions? And if a column’s, name, type, or 
>>>> nullability changes, would that still be a single point of update?
>>>> 
>>>> Multi-table entities and flattened attributes/relationships
>>>> These are genuinely useful. I’m assuming the plan is to keep the 
>>>> capability (an Entity can still pull attributes across relationship 
>>>> paths), just without the separate DbRelationship bookkeeping. Is that the 
>>>> direction?
>>>> 
>>>> Seeing the full table structure
>>>> One thing I find useful sometimes is being able to look at a DbEntity and 
>>>> immediately see every column, the PK strategy, etc. In a unified model, 
>>>> would there still be a clear “this is the complete physical table” view, 
>>>> or would that information only be visible if some Entity happens to map 
>>>> all the columns?
>>>> 
>>>> Can you please clarify how these things would be expressed in the new 
>>>> design.
>>>> Thanks for all the ongoing work on Cayenne.
>>>> 
>>>> Kind regards,
>>>> Jurgen
>>>> 
>>> 
>> 
> 

Reply via email to