|
Re: Howto map a map? [message #666853 is a reply to message #666821] |
Sat, 23 April 2011 11:01 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hmm this seems to work fine:
<orm:one-to-many name="writers">
<orm:map-key-class class="java.lang.String"/>
<orm:map-key-column table="_1303556303411"/>
<orm:join-table name="_1303556303411"/>
<orm:cascade>
<orm:cascade-all/>
</orm:cascade>
</orm:one-to-many>
So I explicitly set the table of the map key column, if I don't set the tablename in the map-key-column/join-table then
EclipseLink throws an exception (the same as in the previous post). But I prefer EclipseLink to generate the table name,
is there a mapping I can use without specifying an explicit table name?
gr. Martin
On 04/22/2011 10:07 PM, Martin Taal wrote:
> Hi,
> I have a field/member which has this type;
> public Map<String, Writer> getWriters() {
> return writers;
> }
>
> the key of the map is not a property of the writer, so a join table is needed. How do I map this using an orm xml file?
>
> I tried this:
> <orm:one-to-many name="writers">
> <orm:map-key-class class="java.lang.String"/>
> <orm:join-table/>
> <orm:cascade>
> <orm:cascade-all/>
> </orm:cascade>
> </orm:one-to-many>
>
> But then I get this:
> The field [BOOK.WRITERS_KEY] in this expression has an invalid table in this context.
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
Powered by
FUDForum. Page generated in 0.02643 seconds