[hibernate-dev] OGM embedded collection handling
Jonathan Halliday
jonathan.halliday at redhat.com
Wed Jul 1 10:59:13 EDT 2015
So I'm tinkering with the cassandra OGM backend, looking particularly at
@ElementCollection since cassandra has native collection types, use of
which would sidestep the current limitations on List's bag semantics at
the same time as improving performance.
The ORM core we sit on assumes that such collections map to a separate
table, that being the Relational Way. So assorted munging of metadata
is needed to change that model in the backend...
At schema definition time it's necessary to identify which Tables should
just pass though to underlying db tables and which should be intercepted
and rewritten as embedded collection types in the owning table. (hint:
associationKeyMetadata.getAssociationKind() ==
AssociationKind.EMBEDDED_COLLECTION)
Having picked out the ones to embed, it's then necessary to figure out
what to embed them into. This is where things get sticky - chaining
through to the EntityKeyMetaData's Table should reveal where the
collection belongs, but it seems that currently
OgmCollectionPersister.targetEntityKeyMetadata initialises that to point
to the embedded table, not the owning entity's table. IMO that's a bug,
but I may be misinterpreting the intent of that metadata. If it is
behaving correctly, then how can the relationship information be discovered?
thanks
Jonathan.
--
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Matt Parson
(USA), Charlie Peters (USA), Michael O'Neill(Ireland)
More information about the hibernate-dev
mailing list