persistence@glassfish.java.net

Re: AW: Problems Mapping Map

From: fedr <fury123_at_gmail.com>
Date: Fri, 4 Apr 2008 14:27:17 -0700 (PDT)

Juerg.Treichler wrote:
>
> Hi
>
> In Class2 you need a reference to Class1.
> This reference is the @MapKey in the Class3.
>
> If you load the a class3 object the system loads all corresponding Class2
> objects and use the key (the reference to class1) from the loaded class2
> objects.
>
> Kind regards
>
> Jürg
>


i tried this; on Class2 i put a Class1 reference:

private Class1 mapkey; and i setup the accessor methods

on Class3 i put:

@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
        @MapKey(name = "mapkey")
        public Map<Class1, Class2> getHm() {
                return hm;
        }

what i notice is that when i create a Class2 object i have to store on it
the Class1 object that is the key of the Map, it is not automatic.

But anyway with this solution i can have only one key-value pair, there is
only one reference to Class1.
I can't have more keys that refer to the same value, it's not a real Map.

I think i miss something.

Can you tell me what is wrong?

thanks for help.








-- 
View this message in context: http://www.nabble.com/Problems-Mapping-Map-tp16468447p16500172.html
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.