|
Working on OGM-702, I noticed that MongoDBTupleSnapshot#getColumnNames() only is implemented correctly for "simple" columns, by just returning the keys of the underlying DBObject.
For embedded objects we'd have to flatten the affected columns, though. E.g. we'd have to return column names such as "address.city", "address.street" etc. (currently we'd only return "address"). Also for the id we'd return "_id" (as that's what always is used in MongoDB) but it likely should be the name from the "physical" JPA model for consistency reasons.
I'm wondering though whether getColumnNames() really is needed at all. It is used at some places, but maybe we can circumvent the need for it by always driving the accessal of tuple columns from the "inbound" side, i.e. based on the model, selected query columns or similar.
Note that I didn't find an actual problem caused by the current implementation, it seems to be a consistency issue atm. There may be an issue when using an embeddable type as optimitic locking version as we access the column names in this case (also see the TODO at MongoDBDialect#org.hibernate.ogm.datastore.mongodb.MongoDBDialect.updateTupleWithOptimisticLock(EntityKey, Tuple, Tuple, TupleContext)).
|