![](/img/trans.png)
[英]Exception Description CustomerTransaction] uses a non-entity [class java.lang.Long] as target entity in the relationship attribute [field id]
[英]class uses a non-entity [class java.lang.Boolean] in HashMap?
我想在Presentation类(JPA实体)中包含以下字段:
private HashMap<User, Boolean> users = new HashMap();
但是当我运行数据库测试(用测试数据填充数据库)时,出现以下错误消息:
[class domein.Presentation] uses a non-entity [class java.lang.Boolean]
as target entity in the relationship attribute [field users].
我试过使用注解@ElementCollection
和@BasicMap
但它们都不起作用。 我当前的解决方案是创建一个新的Entity类MyBoolean
,但这是丑陋的代码。 我怎样才能做到这一点?
JPA不提供键为实体且值非实体的Map。 JDO支持该FWIW。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.