[hibernate-dev] [OGM] @Column and embedded objects in OGM

Emmanuel Bernard emmanuel at hibernate.org
Wed Jan 6 03:40:23 EST 2016


Hey guys,

Marco found something that really surprised him. I am not sure if that’s a widespread behavior or just specific to CouchDB’s backend.

@Entity
class A {
   …
   B embedded;
}

@Embeddable
class B {
    String c;
    @Column(name=“real_d”) d;
}

The document structure is roughly

{
…
    “embedded”: { “c”: “foo” },
    “real_d”: “bar"
}

I can see this is happening because the column name has not dot in it. But I would expect as a noob to see the natural behavior and have real_d embedded in the nested document embedded.

Looks like MongoDB does the same and I suspect Noe4J too.

1. Can any one think of a trick (like the naming strategy or something like that) to compensate and do it “right”.
2. If not, I could not find anything in the documentation nor the FAQ and we should make that very obvious. I finally found some info in the embedded section of MongoDB but Neo4J and CouchDb are silent on the matter. How could we make that clearer in the mean time? FAQ?

Emmanuel


More information about the hibernate-dev mailing list