Skip to content

Commit 85b7f16

Browse files
dmealingclaude
andcommitted
docs: scrub retired @referencedBy + value*/data* references from unused fixtures + migration docs (SP-G Java recon)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 62c333f commit 85b7f16

5 files changed

Lines changed: 141 additions & 43 deletions

File tree

server/java/MIGRATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
7.1.0 is a cleanup release with three **breaking** packaging changes for consumers already on 7.0.0, plus additive features (full list in [RELEASE_NOTES.md](RELEASE_NOTES.md#version-710-2026-05-28)).
66

77
1. **OSGi runtime variant removed.** If you consumed the OSGi bundles or called the OSGi-specific `ServiceRegistry` methods, see [OSGi support removed](#osgi-support-removed) below for the exact API delta and the `bnd` / `pax-url` wrap path.
8-
2. **`metaobjects-dynamic-core` folded into `metaobjects-metadata`.** Drop any `com.metaobjects:metaobjects-dynamic-core` dependency — its `CoreObjectsMetaDataProvider` (and the `dataBuilderClass` / `valueObjectType` attribute extensions on `object.base`) now ship inside `metaobjects-metadata`. No change for consumers of those attribute names.
8+
2. **`metaobjects-dynamic-core` folded into `metaobjects-metadata`.** Drop any `com.metaobjects:metaobjects-dynamic-core` dependency — its `CoreObjectsMetaDataProvider` now ships inside `metaobjects-metadata`. The `value*` / `data*` attribute extensions it used to contribute onto `object.base` (e.g. `valueObjectType`, `dataBuilderClass`, `dataImmutable`) have been **removed** — generated-object flavor is now derived from the codegen generator's configuration, not from metamodel attributes. If you authored any of those attributes in metadata, delete them.
99
3. **`archetype` / `examples` directories deleted.** No action unless you referenced them as source.
1010

1111
Additive (opt-in) in 7.1.0: [programmatic provider registration](#programmatic-provider-registration-new-in-710), the `TemplateGenerator` render API in `metaobjects-render`, `codegen-spring` `hasFoo()` presence helpers for nullable record fields, and `codegen-kotlin` `text()` mapping for jsonb-backed string fields.
@@ -46,7 +46,7 @@ Five module additions in 7.0.0 (none required; opt in per stack):
4646
| `metaobjects-metadata-ktx` | Kotlin facade over the Java metadata core |
4747
| `metaobjects-omdb-ktx` | Kotlin facade over OMDB |
4848

49-
The `metaobjects-dynamic-core` module from 6.x is gone — its `CoreObjectsMetaDataProvider` (which contributed `dataBuilderClass`, `valueObjectType`, etc., attribute extensions onto `object.base`) now ships inside `metaobjects-metadata`. Consumers of those attribute names need no change; consumers of the `metaobjects-dynamic-core` artifact coordinate should drop the dependency.
49+
The `metaobjects-dynamic-core` module from 6.x is gone — its `CoreObjectsMetaDataProvider` now ships inside `metaobjects-metadata`. The `value*` / `data*` attribute extensions it once contributed onto `object.base` (`dataBuilderClass`, `valueObjectType`, `dataImmutable`, etc.) have since been **removed**: generated-object flavor is derived from the codegen generator's configuration rather than from metamodel attributes, so there is nothing for consumers to register or author. Consumers of the `metaobjects-dynamic-core` artifact coordinate should drop the dependency; any of those attributes still present in authored metadata should be deleted.
5050

5151
### OSGi support removed
5252

server/java/metadata/src/test/resources/relationship-examples/README.md

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,29 @@ This directory contains example metadata JSON files demonstrating the MetaObject
44

55
## Core Relationship Patterns
66

7-
### Essential Attributes (AI specifies these 4)
7+
### Essential Attributes (AI specifies these)
88

99
1. **`@objectRef`** - The target object this relationship points to
1010
2. **`@cardinality`** - Either "one" or "many"
1111
3. **`@ownership`** - Either "owns" or "references"
12-
4. **`@referencedBy`** - Field name that implements the relationship
12+
13+
### FK direction is declared by `identity.reference`, not on the relationship
14+
15+
A relationship no longer restates the implementing FK field. Foreign-key
16+
direction is the responsibility of an **`identity.reference`** child on the entity
17+
that physically holds the FK column:
18+
19+
```json
20+
{ "identity.reference": { "name": "categoryRef", "@fields": "categoryId", "@references": "Category" } }
21+
```
22+
23+
- **`@fields`** - the local FK field (or comma-separated fields for a composite key)
24+
- **`@references`** - the target entity the FK points at
25+
26+
For a `@cardinality: "one"` relationship the FK lives on the declaring entity, so
27+
that entity carries the `identity.reference`. For `@cardinality: "many"` the FK
28+
lives on the child (one-to-many) or in a junction entity (many-to-many), so the
29+
`identity.reference` lives there. The relationship itself stays purely semantic.
1330

1431
### Derived Properties (automatic)
1532

@@ -25,13 +42,16 @@ This directory contains example metadata JSON files demonstrating the MetaObject
2542
"name": "profile",
2643
"@objectRef": "UserProfile",
2744
"@cardinality": "one",
28-
"@ownership": "owns",
29-
"@referencedBy": "profileId"
45+
"@ownership": "owns"
3046
}
3147
}
3248
```
49+
FK is on the declaring (parent) entity:
50+
```json
51+
{ "identity.reference": { "name": "profileRef", "@fields": "profileId", "@references": "UserProfile" } }
52+
```
3353
**Meaning**: Parent object owns exactly one child object. When parent is deleted, child is also deleted.
34-
**RDB Implementation**: Foreign key in child table, cascade delete
54+
**RDB Implementation**: Foreign key on the parent row, cascade delete
3555
**Examples**: User → Profile, Order → PaymentInfo
3656

3757
### 2. One-to-Many Composition (owns + many)
@@ -41,11 +61,14 @@ This directory contains example metadata JSON files demonstrating the MetaObject
4161
"name": "addresses",
4262
"@objectRef": "Address",
4363
"@cardinality": "many",
44-
"@ownership": "owns",
45-
"@referencedBy": "addressIds"
64+
"@ownership": "owns"
4665
}
4766
}
4867
```
68+
FK is on the child entity (`Address`), declared there:
69+
```json
70+
{ "identity.reference": { "name": "userRef", "@fields": "userId", "@references": "User" } }
71+
```
4972
**Meaning**: Parent object owns multiple child objects. When parent is deleted, all children are deleted.
5073
**RDB Implementation**: Foreign key in child table, cascade delete
5174
**Examples**: User → Addresses, Order → OrderItems
@@ -57,13 +80,16 @@ This directory contains example metadata JSON files demonstrating the MetaObject
5780
"name": "manager",
5881
"@objectRef": "User",
5982
"@cardinality": "one",
60-
"@ownership": "references",
61-
"@referencedBy": "managerId"
83+
"@ownership": "references"
6284
}
6385
}
6486
```
87+
FK is on the declaring entity:
88+
```json
89+
{ "identity.reference": { "name": "managerRef", "@fields": "managerId", "@references": "User" } }
90+
```
6591
**Meaning**: Parent object references exactly one independent object. Lifecycle is independent.
66-
**RDB Implementation**: Foreign key in parent table, no cascade delete
92+
**RDB Implementation**: Foreign key on the declaring row, no cascade delete
6793
**Examples**: Employee → Manager, Order → Customer
6894

6995
### 4. One-to-Many Association (references + many)
@@ -73,13 +99,12 @@ This directory contains example metadata JSON files demonstrating the MetaObject
7399
"name": "favoriteProducts",
74100
"@objectRef": "Product",
75101
"@cardinality": "many",
76-
"@ownership": "references",
77-
"@referencedBy": "favoriteProductIds"
102+
"@ownership": "references"
78103
}
79104
}
80105
```
81106
**Meaning**: Parent object references multiple independent objects. Lifecycle is independent.
82-
**RDB Implementation**: Junction table or array of foreign keys
107+
**RDB Implementation**: Junction table; each FK side is declared as an `identity.reference` on the junction entity (see M:N vocabulary)
83108
**Examples**: User → FavoriteProducts, Category → Products
84109

85110
## Example Files
@@ -110,7 +135,9 @@ AI only needs to choose:
110135
1. **Target Object** - What object does this point to?
111136
2. **Cardinality** - One or many?
112137
3. **Ownership** - Does parent own the child or just reference it?
113-
4. **Field Name** - What field implements this relationship?
138+
139+
The implementing FK is declared separately as an `identity.reference` on whichever
140+
entity physically holds the FK column.
114141

115142
### Cross-Language Mapping
116143
The semantic model maps directly to:
@@ -184,10 +211,13 @@ The relationship system replaces the database-specific MetaKey system:
184211
"name": "user",
185212
"@objectRef": "User",
186213
"@cardinality": "one",
187-
"@ownership": "references",
188-
"@referencedBy": "userId"
214+
"@ownership": "references"
189215
}
190216
}
191217
```
218+
with the FK direction declared on the entity that holds the column:
219+
```json
220+
{ "identity.reference": { "name": "userRef", "@fields": "userId", "@references": "User" } }
221+
```
192222

193223
The relationship approach is more semantic and works across different persistence technologies (RDB, document stores, graph databases).

server/java/metadata/src/test/resources/relationship-examples/blog-relationships.json

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,24 @@
4141
"@maxLength": 100
4242
}
4343
},
44+
{
45+
"identity.reference": {
46+
"name": "profileRef",
47+
"@fields": "profileId",
48+
"@references": "AuthorProfile"
49+
}
50+
},
4451
{
4552
"relationship.composition": {
4653
"name": "posts",
4754
"@cardinality": "many",
48-
"@referencedBy": "postIds",
4955
"@objectRef": "BlogPost"
5056
}
5157
},
5258
{
5359
"relationship.composition": {
5460
"name": "profile",
5561
"@cardinality": "one",
56-
"@referencedBy": "profileId",
5762
"@objectRef": "AuthorProfile"
5863
}
5964
}
@@ -167,27 +172,31 @@
167172
"@required": true
168173
}
169174
},
175+
{
176+
"identity.reference": {
177+
"name": "categoryRef",
178+
"@fields": "categoryId",
179+
"@references": "Category"
180+
}
181+
},
170182
{
171183
"relationship.composition": {
172184
"name": "comments",
173185
"@cardinality": "many",
174-
"@referencedBy": "commentIds",
175186
"@objectRef": "Comment"
176187
}
177188
},
178189
{
179190
"relationship.association": {
180191
"name": "tags",
181192
"@cardinality": "many",
182-
"@referencedBy": "tagIds",
183193
"@objectRef": "Tag"
184194
}
185195
},
186196
{
187197
"relationship.association": {
188198
"name": "category",
189199
"@cardinality": "one",
190-
"@referencedBy": "categoryId",
191200
"@objectRef": "Category"
192201
}
193202
}
@@ -247,19 +256,24 @@
247256
"@column": "approved"
248257
}
249258
},
259+
{
260+
"identity.reference": {
261+
"name": "parentCommentRef",
262+
"@fields": "parentCommentId",
263+
"@references": "Comment"
264+
}
265+
},
250266
{
251267
"relationship.association": {
252268
"name": "parentComment",
253269
"@cardinality": "one",
254-
"@referencedBy": "parentCommentId",
255270
"@objectRef": "Comment"
256271
}
257272
},
258273
{
259274
"relationship.association": {
260275
"name": "replies",
261276
"@cardinality": "many",
262-
"@referencedBy": "replyIds",
263277
"@objectRef": "Comment"
264278
}
265279
}
@@ -347,11 +361,17 @@
347361
"@maxLength": 500
348362
}
349363
},
364+
{
365+
"identity.reference": {
366+
"name": "parentCategoryRef",
367+
"@fields": "parentCategoryId",
368+
"@references": "Category"
369+
}
370+
},
350371
{
351372
"relationship.association": {
352373
"name": "parentCategory",
353374
"@cardinality": "one",
354-
"@referencedBy": "parentCategoryId",
355375
"@objectRef": "Category"
356376
}
357377
}

0 commit comments

Comments
 (0)