[hibernate-dev] [OGM] AssociationKey table property during the create tuple association
Emmanuel Bernard
emmanuel at hibernate.org
Wed Mar 7 11:35:19 EST 2012
No, you should have two RowKeys, one for Entity A and one for Entity B (speaking of instances here).
AssociationKey represents the navigational info to go from A to B (B to A would be represented by a second AssociationKey object).
And what would be stored is the list of navigational info (in your case one to one, the list is of size 0 or 1).
The nav info is made of:
- the fk from A
- the fk to B
- optionally the index or map key value
The AssociationKey is made of:
- the association table name (in your example EntityA)
- the asso fk name and value, in your case entityb_id: "abc"
On 7 mars 2012, at 17:08, Guillaume SCHEIBEL wrote:
> Hello,
>
> I'm writting the OGM dialect for mongodb and I work on the @OneToOne
> association.
> When the createTupleAssociation method is called, there is an
> AssociationKey parameter which should (I think) represents the object to
> which we are associated.
>
> Let's take a very short example:
>
> class EntityA {
>
> @Id
> String id;
>
> @OneToOne
> EntityB entityb;
>
> //with getters, setters, etc.
> }
>
> class EntityB {
> @Id
> String id;
>
> //with getters, setters, etc.
> }
>
> Currently, the rowKey object refers to EntityA (with the table name and the
> id) and AssociationKey refers to EntityB. But the table property of
> AssociationKey is set to entityA and not entityB as it should be.
>
> Did I miss something or is it a real "bug" ?
>
> Thanks
> Guillaume
> _______________________________________________
> 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