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

Emmanuel Bernard emmanuel at hibernate.org
Thu Jan 7 02:45:48 EST 2016


I've replied in OGM-893 as things came back to me. That's a proposal,
there might be even better options.

On the FAQ, I'm fine if you think that's unimportant to mention at that
level. But the doc at least would need to be fixed until we have OGM-893
in.

On Wed 2016-01-06 11:40, Gunnar Morling wrote:
> Hi,
> 
> Yes, I noticed this some time ago, too. It's tracked by
> https://hibernate.atlassian.net/browse/OGM-893.
> 
> As it stands, I don't think it's fixable using the ORM
> ImplicitNamingStrategy/PhysicalNamingStrategy contracts: The former
> doesn't apply for explicitly given names, the latter lacks the
> required context to establish the full dot name.
> 
> So maybe we could enhance PhysicalNamingStrategy - or have a new
> contract specifically for preparing explicit names - to expose the
> full attribute path, allowing implementations to prefix the column
> with the parent name(s) as we'd need it for the document stores.
> 
> Btw. a - cumbersome - workaround is to use @AttributeOverride which
> allows to create the right mapping. We can add something to the FAQ if
> you like, but then I think it's a bug really which we need to fix, and
> we don't have an FAQ entry for each bug.
> 
> --Gunnar
> 
> 
> 
> 2016-01-06 9:40 GMT+01:00 Emmanuel Bernard <emmanuel at hibernate.org>:
> > 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
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list