Open lukaseder opened 9 months ago
Is it possible to find the parent table of an embedded primary key given just the embedded record?
@alf Embedded keys are just a code generation convenience feature, where the code generator makes sure that primary/unique constraints will generate the same embeddable type as the referencing foreign keys. There's no runtime information generated about the types being derived from keys.
You can, of course, query the generated code using Java reflection to find out who references an embedded type, and then implement heuristics, knowing your own code generation configuration.
I guess it could make sense, in some cases, to maintain meta information about this relationship. If you're interested in that, could you please create a new feature request with details about your use-case?
Created feature request: https://github.com/jOOQ/jOOQ/issues/16803
This is a continuation of #8353, #10527, and #11975, which fixed a lot of issues already in jOOQ 3.14 / 3.15 / 3.19
Runtime library (known issues)
UPDATE .. SET emb1 = (SELECT emb2 ..)
.SET (a, b) = (SELECT x, y)
, see #10522 and #10523INSERT .. VALUES ((SELECT emb))
doesn't work, if embeddable has more than one column.ORDER BY
issuesORDER BY .. NULLS FIRST / LAST
emulationsSEEK
Field<? extends EmbeddableRecord>
that is not aVal
, but aRowField
(let's wait for use-cases)Record::fromArray
flattens embeddables, even if there are embeddable fields in the record. There are probably other unmappers that also don't work.SELECT embeddable AS e
FROM (SELECT embeddable FROM t) AS t (a, b, c)
Record.from()
andRecord.into()
don't work when fields are renamed, see https://github.com/jOOQ/jOOQ/issues/11178TableAsField
orRowAsField
containing embeddeables: https://github.com/jOOQ/jOOQ/issues/15991UpdatableRecord
: https://github.com/jOOQ/jOOQ/issues/16114RETURNING
: https://github.com/jOOQ/jOOQ/issues/16187MULTISET
projections: https://github.com/jOOQ/jOOQ/issues/16310SelectIsNull
: https://github.com/jOOQ/jOOQ/issues/16319DSLContext::fetchCount
: https://github.com/jOOQ/jOOQ/issues/16326Runtime library (not integration tested yet)
INSERT .. SELECT
MERGE
ALTER TABLE
<replaceFields/>
feature:UpdatableRecord.key()
calls (see also code generation issue, below)Table.getPrimaryKey()
and similar methodsCOALESCE()
,NVL()
, etc.Code generator (known issues)
fetchOneByXYZ()
methods in DAOs for<embeddablePrimaryKeys/>
(is it possible?): https://github.com/jOOQ/jOOQ/issues/11188<embeddablePrimaryKeys/>
generated key record from generated DAOs as wellIXYZ
interface is declared on theEmbeddableRecord
, but not generated)(A, B, C)
and an FK on(A, B)
should produce an embeddable type of the structural form((A, B), C)
UpdatableRecord.key()
method does not produce correct typeCode generator (not integration tested yet)
UDTRecord
typesUDTRecord
types containing embeddables (probably won't be supported)