Question

I want to have the following field in my Presentation class (JPA entity):

private HashMap<User, Boolean> users = new HashMap();

but when I run our databasetest (fill db with testdata), I get the following errormessage:

[class domein.Presentation] uses a non-entity [class java.lang.Boolean]
 as target entity in the relationship attribute [field users].

I have tried using the annotations @ElementCollection and @BasicMap but they both don't work. My current solution is to make a new Entity class MyBoolean, but that is ugly code. How can I do this?

Was it helpful?

Solution

JPA doesn't provide for a Map with the key being an Entity and the value being a non-Entity. JDO supports that FWIW.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top