Skip to main content

Anyone who tried to persist an Entity that contains a Map ?

3 replies [Last post]
ameyec
Offline
Joined: 2005-02-20

I want to persist an Entity containing a Map.
This always fails with a NullPointer exception in the toplink code ...

If I remove the getter and setter for the map, the null pointer problem disappears.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
stvconsultants
Offline
Joined: 2006-03-06

There seems to have been a big improvement in the toplink code between b40 and b41 (at least it's got rid of one or two annoying bugs for me and the error messages are a bit more friendly)

Have you tried with b41.

I'm already removing hacks I had all over the place just to get my code to run!

BTW I have not tried a map yet as it's a legacy database that I'm coding entities for (with @JoinColumns all over the place)

Performance seems quicker too (but maybe that's just the result of me removing my hacks!)

ameyec
Offline
Joined: 2005-02-20

It seems that my nullpointer happened because of the lack of a @OneToMany Annotation. Simple. But the error message was not saying anything clear, That's for sure.

I will try b41 too. Thanks for the tip. :-)

ameyec
Offline
Joined: 2005-02-20

Let me add to this that the EJB Persistence PFD allows entities to contain Maps.

Oh and I am using Glassfish b40