1

I wonder if it is possible to have the following data structure in a jpa managed entity.

@Entity
public MyEntity {

    @ElementCollection
    public Map<String, Set<MyEntityTwo>> map;
}

I did some basic tests but come up with the following error:

JPA error
A JPA error occurred (Unable to build EntityManagerFactory): Could not determine type for: java.util.Set, at table: ModelOne_map, for columns: [org.hibernate.mapping.Column(map)]

play.exceptions.JPAException: Unable to build EntityManagerFactory
emt14
  • 4,846
  • 7
  • 37
  • 58

1 Answers1

2

Found this link which states that it is not possible with standard JPA and that the prefered way is to create a wrapper object.

Community
  • 1
  • 1
emt14
  • 4,846
  • 7
  • 37
  • 58