https://issues.apache.org/jira/browse/OPENJPA-1021 


-----Original Message-----
From: Fay Wang [mailto:[email protected]] 
Sent: Friday, April 03, 2009 1:05 AM
To: [email protected]
Subject: Re: Map field ... is attempting to use a map table, but its key
is mapped by another field. Use an inverse key or join table mapping.


Hi Mike,
    Regarding #2, you can take a look at an Openjpa test case:

         org.apache.openjpa.persistence.jdbc.meta.TestMappedByKeyMaps

   This test case tests InverseKeyMapMapping and JoinTableMapMapping.

   When MapKey annotation is applied, the map field strategy should be
RelationMapTableStrategy as the map key is a field of the entity which
is the map value. However, since the map key is a relation, openjpa
wrongly (I believe) set the strategy as
RelationRelationMapTableFieldStrategy. This strategy is used when the
map key is an independent entity. An exception is therefore thrown out
when a MapKey annotation is detected by this strategy.


-Fay

 
 



----- Original Message ----
From: Michael Vorburger <[email protected]>
To: [email protected]; [email protected]
Sent: Thursday, April 2, 2009 3:06:01 PM
Subject: RE: Map field ...  is attempting to use a map table, but its
key is mapped by another field.  Use an inverse key or join table
mapping.

I can open a JIRA, BUT... a few points: 

1. Pinaki, you responded to a very similar question for what appears to
be a very similiar domain model (a Map with some Translation (relation)
field as key) that "OpenJPA can map this domain model using
@PersistenceMap" on
http://n2.nabble.com/Map%3CClassA,ClassB%3E-problem-td534546.html ...
any advise on how?  The link you had provided in that post 404s (and
what I think you probably referred to in the doc doesn't actually have
such an example)

2. Fay, I've actually tried this on OpenJPA 1.2.0... what does the error
"Use an inverse key or join table mapping." actually mean, how would one
use an inverse key (to what?).

3. Reg. JPA 2.0, the spec actually says "If the map key type is an
entity, the MapKeyJoinColumn and MapKeyJoinColumns annotations are used
to specify the column mappings for the map key." ... would anybody be
able to try my example as a test on the OpenJPA for JPA 2.0 version?




-----Original Message-----
From: Fay Wang [mailto:[email protected]]
Sent: Thu 4/2/2009 10:05 PM
To: [email protected]
Subject: Re: Map field ...  is attempting to use a map table, but its
key is mapped by another field.  Use an inverse key or join table
mapping.


It appears that openjpa currently does not support MapKey annotation
applied to a relation field. This, however, is not explicitly stated in
the user guide or JPA 2.0 spec. Please open a JIRA for it. Thanks!




----- Original Message ----
From: Michael Vorburger <[email protected]>
To: [email protected]
Sent: Thursday, April 2, 2009 8:00:28 AM
Subject: Map field ...  is attempting to use a map table, but its key is
mapped by another field.  Use an inverse key or join table mapping.

Hello!

Would anybody be able to enlighten us on how to "Use an inverse key or
join table mapping." with a @PersistentMap... I'm encoutering the "Map
field ...  is attempting to use a map table, but its key is mapped by
another field.  Use an inverse key or join table mapping." error
message.

Full test case reproducing this is attached... you'll find three
Entities, a Language, a Translation (with a field of type Language), and
a Something which has a Map<Language, Translation> ... sounds trivial?
;-)  -- That 'entity_dict_id' you'll find on the Translation is a kind
of "discriminator" (but not for subclassing, I need to use it to
"classify" the map association - imagine that in real world there is
SomethingElse and many other Entities which are also translated, all
stored in one and the same Translation table.)

I'm sure this is possible, I gathered standard JPA 1.0's @OneToMany with
a @MapKey can not do this, but with a @PersistentMap this should work...
only how?? Any help appreciated...

Thanks a lot,
Michael

____________________________________________________________

. This email and any files transmitted with it are CONFIDENTIAL and
intended
  solely for the use of the individual or entity to which they are
addressed.
. Any unauthorized copying, disclosure, or distribution of the material
within
  this email is strictly forbidden.
. Any views or opinions presented within this e-mail are solely those of
the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
. An electronic message is not binding on its sender. Any message
referring to
  a binding engagement must be confirmed in writing and duly signed.
. If you have received this email in error, please notify the sender
immediately
  and delete the original.


      



____________________________________________________________

* This email and any files transmitted with it are CONFIDENTIAL and
intended
  solely for the use of the individual or entity to which they are
addressed.
* Any unauthorized copying, disclosure, or distribution of the material
within
  this email is strictly forbidden.
* Any views or opinions presented within this e-mail are solely those of
the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
* An electronic message is not binding on its sender. Any message
referring to
  a binding engagement must be confirmed in writing and duly signed.
* If you have received this email in error, please notify the sender
immediately
  and delete the original.


      

____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.

Reply via email to