2

I have troubles with following relationship:

 @Entity
 public class Account {
     @OneToMany
     private Map<SomeEntity, WrapperEntity> myMap;
     // getter, setters, etc.
 }

With the Wrappper Entity:

 @Entity
 public class WrapperEntity {
     @OneToMany
     private Set<SomeOtherEntity> otherEntities;
 }

When i try to run this, i get an EclipseLink exception:

Exception [EclipseLink-93] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The table [WRAPPERENTITY] is not present in this descriptor.

But: if i make the relationship bidirectional and add a mappedBy to the Account class, the project will run. Is this behavior intended? Have i overlooked something?

When using bidirectional relationship, another think seems strange to me: the tables are filled in an incomplete way, I think. The table WrapperEntity has the column myMap_key, in which nothing is stored if i save a corresponding map entry. I looked for bugs in eclipselink, but couldn't find something similar.

bmurauer
  • 989
  • 8
  • 24
  • the default for OneToMany should use a relation table, so I don't see why table "WRAPPERENTITY" would have any columns added to it to support the mappings you have specified. Is there mapping configuration you have not specified in the post? Try posting the full error stack as well, and what the WrapperEntity.otherEntities mapping has to do with the problem as it doesn't seem related. – Chris Aug 09 '13 at 17:30
  • Try @OneToMany(mappedBy="someEntity", targetEntity = SomeEntity.class) – timmz May 08 '15 at 20:19

0 Answers0