문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top